This page is still under construction.

Parts of this page are still being built. What you see may change.

Professor Lee's Exam

Time limit1sMemory limit256 MB

Summary
Print the numbers of students whose ten answers exactly match 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 in order.
Level

Easy1 of 10

Topics
Implementation, Array
Solved
No attempts yet

Problem

Professor Lee teaches at UCPC. His final exam is multiple choice and has ten questions. For each question a student picks the one option, out of five, that comes closest to the answer. The questions are hard, so almost nobody gets a perfect score.

This semester the correct answers followed a rule. The answer to question jj is option ((j−1) mod 5)+1((j-1) \bmod 5) + 1, where  mod \bmod is the remainder operation. For question 1 the answer is ((1−1) mod 5)+1=1((1-1) \bmod 5) + 1 = 1, option 1, and for question 8 it is ((8−1) mod 5)+1=3((8-1) \bmod 5) + 1 = 3, option 3. Questions are numbered 1 to 10 and options are numbered 1 to 5.

Many students noticed the rule during the exam. They solved the easy questions at the front, worked out the formula, and then answered the hard questions at the back without solving them. Professor Lee treats that as cheating, so every student with a perfect score has to sit a new exam. The answers of the new exam follow no rule.

You are given the answer sheets of NN students. Write a program that finds the list of students who have to sit the new exam.

Input

The first line contains the number of students NN who took the exam. (1≤N≤1001 \le N \le 100)

Each of the next NN lines contains ten integers between 1 and 5, separated by spaces. The jj-th number on the ii-th line is the option that student ii chose for question jj. (1≤i≤N1 \le i \le N, 1≤j≤101 \le j \le 10)

Output

Print the numbers of the students who have to sit the new exam in increasing order, one per line.

If no student has to sit it, print nothing.

Examples2

  1. Example 1

    Input
    5
    1 1 1 1 1 1 1 1 1 1
    1 2 3 4 5 1 2 3 4 5
    3 2 2 1 5 1 2 2 2 2
    1 2 3 4 5 1 2 3 4 5
    1 2 3 4 5 1 2 3 4 5
    
    Expected output
    2
    4
    5
    
  2. Example 2

    Input
    1
    1 2 3 4 5 1 2 3 4 5
    
    Expected output
    1