Similarity Graph

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Let pp and qq be two permutations of 1,2,,N\\{1,2,\dots ,N\\}.

Similarity graph of pp and qq, S(p,q)S(p,q), is defined as following:

  • S(p,q)S(p,q) has NN labeled vertices, numbered from 11 to NN.
  • There is a edge between vertex ii and jj if and only if p_i\<p_jp\_i\<p\_j and q_i\<q_jq\_i\<q\_j are both true, or both false. (1i\<jN1\leq i\<j\leq N)

You are given a simple undirected graph GG with NN labeled vertices, numbered from 11 to NN.

Find a pair (p,q)(p,q) of permutations of 1,2,,N\\{1,2,\dots ,N\\}, satisfying S(p,q)=GS(p,q) =G.

입력

The first line contains one integer, NN.

The next NN lines contain space-separated NN integers. The jj-th integer of the ii-th line is E(i,j)E(i,j). E(i,j)E(i,j) is 11 if there is an edge between vertex ii and vertex jj, and 00 otherwise.

출력

If it is impossible to find pp and qq satisfying the condition, output NO.

Otherwise, output YES on the first line. On the following two lines, output pp and qq. If there are multiple answers, output any.

제한

  • 1N1001\le N\le 100
  • 0E(i,j)10\le E(i,j)\le 1 (1i,jN1\le i,j\le N)
  • E(i,j)=E(j,i)E(i,j) =E(j,i) (1i\<jN1\le i\<j\le N)
  • E(i,i)=0E(i,i) =0 (1iN1\le i\le N)