Eunki's DNA Molecules

No attempts yetTime limit5sMemory limit256 MB

Problem

A DNA string uses A, C, G, T. Apply these bidirectional substring replacements:

  • A ↔ TC
  • C ↔ AG
  • G ↔ CT
  • T ↔ GA

For NN strings, output whether each pair can transform from the first to the second.

Input

Line 1: NN (2N1002 \le N \le 100). Next NN DNA strings (length 50000\le 50\,000).

Output

NN lines of NN 0/1 chars; 1 at (i,j)(i,j) means string ii can become string jj.