On an n×n chessboard (1≤n≤3000) we place n rooks, one per rook index. The placement must satisfy the following rules.
Decide whether all rooks can be placed inside their rectangles without any two attacking each other, and if so, output one such placement.
The first line contains a single integer n (1≤n≤3000). Each of the next n lines contains four integers ai, bi, ci, di separated by single spaces, describing the rectangle for rook i (1≤ai≤ci≤n, 1≤bi≤di≤n, every value between 1 and n).
If no valid placement exists, print the single word NIE (Polish for "no").
Otherwise print n lines. Line i contains the row and column of rook i separated by a single space, where the row lies in [ai,ci] and the column lies in [bi,di]; the rooks are listed in the same order as their rectangles were given.
Because several placements can be valid, print the lexicographically smallest one. Compare two placements by the sequence formed by reading the values in order: row of rook 1, column of rook 1, row of rook 2, column of rook 2, and so on. Equivalently, make the row of rook 1 as small as possible, then its column as small as possible, then the row of rook 2, then its column, and so on.