Hide

Problem J
Ten Player Bingo

Bingo is a game of chance for multiple players. Each player receives a sheet with some numbers, and a game master then calls out these numbers in a random order. Players cross off the numbers that they have heard, and the first player to cross off all their numbers wins the game. This basic version of the game has a reputation for being, well, a bit sedate. No particular action is required of the players except for not falling asleep.

In this problem we will analyze a specific version of Bingo that requires exactly ten players. In our version, called Ten Player Bingo, each player is numbered from $1$ to $10$. Each player also receives a sheet that contains the integers from $1$ to $100$ that share the same units digit as the units digit of the player’s number. The game master has also been given a sheet that contains every integer from $1$ to $100$ exactly once, but the integers have been shuffled. The game master will read the integers in the order presented on the sheet. When a player has heard all of their integers, they shout “BINGO” and leave the game. The game continues until everyone has shouted “BINGO”.

Who is the last player to shout “BINGO”?

Input

The first and only line of input contains $100$ integers, each ranging from $1$ to $100$. It is guaranteed each integer appears exactly once.

Output

Output a single integer, which is the number of the player who shouts “BINGO” last.

Sample Input 1 Sample Output 1
12 91 49 4 52 95 45 51 50 40 11 5 88 87 39 38 42 89 76 85 30 69 35 81 23 67 32 3 62 8 79 58 1 75 37 27 24 46 18 16 97 61 41 59 13 74 78 54 98 66 14 33 86 55 83 93 63 72 6 19 92 17 56 64 100 53 28 71 7 96 36 57 84 43 73 60 15 77 80 31 20 99 21 90 70 22 26 10 25 2 94 9 82 34 65 68 48 29 44 47
7

Please log in to submit a solution to this problem

Log in