SP987 MOBILE - Mobile

Description

Mobile Manfred loves to build mobiles out of old CDs. For each one, he has an exact plan how it should look like: The CDs are all hanging exactly on the same height. For each pair of CDs, he writes down the height of the lowest bar such that both CDs are hanging somewhere under this bar. For example, the following mobile and distance matrix fit together: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP987/3b7863d3095dedcf15bc15d589709a2445040bb2.png) After a while, Manfred realizes that he does not succeed to build every mobile he planned to. For example, there is no solution for the following distance matrix: 0 1 2 1 0 3 2 3 0 So, he decides to write a computer program that checks the distance matrices and tells him if there is a solution.

Input Format

Several matrices to check. The first row contains the size of the matrix N (N

Output Format

For each matrix, write true if Manfred can build a mobile, false otherwise.