## An Animal Contest 7 P4 - Squirrel Shenanigans

View as PDF

Points: 20
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

After a separate mission, Tony has uncovered the hidden plans of the invading squirrel army. In an attempt to halt all communication on Earth — for an easier conquest — the squirrels are employing secret technologies to flood Discord with Nitro scams. These scams rely on users clicking into suspicious links (after being offered free Nitro, of course) and using their phones to scan QR codes, where then the real shenanigans start. The squirrels will then hijack the user's account and block all their friends after sending them the exact same scam message. Luckily, Tony has found a way to neutralize the threat:

There is a secret permutation of where the -th element is denoted as . What it does, you have no idea — you're just going to have to trust. You are given a QR code represented by an binary matrix , which will help you find . The cell in the -th row from the top and -th column from the left is denoted as . An operation is defined as choosing some index and replacing with the median of . If , it is possible to perform some number of operations (possibly none) on and have . If , this is impossible.

#### Input Specification

The first line contains a single integer .

The next lines contain a binary string of length representing each row of .

#### Output Specification

Output one line containing integers: the permutation .

The data will guarantee that a valid permutation exists.

#### Sample Input

5
10000
00111
00110
00110
01000

#### Sample Output

1 5 3 4 2