{"problem":{"name":"Fair Elevator","description":{"content":"There is a building with $2N$ floors, numbered $1, 2, \\ldots, 2N$ from bottom to top. The elevator in this building moved from Floor $1$ to Floor $2N$ just once. On the way, $N$ persons got on and off","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc104_c"},"statements":[{"statement_type":"Markdown","content":"There is a building with $2N$ floors, numbered $1, 2, \\ldots, 2N$ from bottom to top.\nThe elevator in this building moved from Floor $1$ to Floor $2N$ just once.\nOn the way, $N$ persons got on and off the elevator. Each person $i$ $(1 \\leq i \\leq N)$ got on at Floor $A_i$ and off at Floor $B_i$. Here, $1 \\leq A_i < B_i \\leq 2N$, and just one person got on or off at each floor.\nAdditionally, because of their difficult personalities, the following condition was satisfied:\n\n*   Let $C_i (= B_i - A_i - 1)$ be the number of times, while Person $i$ were on the elevator, other persons got on or off. Then, the following holds:\n    *   If there was a moment when both Person $i$ and Person $j$ were on the elevator, $C_i = C_j$.\n\nWe recorded the sequences $A$ and $B$, but unfortunately, we have lost some of the records. If the record of $A_i$ or $B_i$ is lost, it will be given to you as $-1$.\nAdditionally, the remaining records may be incorrect.\nDetermine whether there is a pair of $A$ and $B$ that is consistent with the remaining records.\n\n## Constraints\n\n*   $1 \\leq N \\leq 100$\n*   $A_i = -1$ or $1 \\leq A_i \\leq 2N$.\n*   $B_i = -1$ or $1 \\leq B_i \\leq 2N$.\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$A_1$ $B_1$\n$A_2$ $B_2$\n$:$\n$A_N$ $B_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc104_c","tags":[],"sample_group":[["3\n1 -1\n-1 4\n-1 6","Yes\n\nFor example, if $B_1 = 3, A_2 = 2$, and $A_3 = 5$, all the requirements are met.\nIn this case, there is a moment when both Person $1$ and Person $2$ were on the elevator, which is fine since $C_1 = C_2 = 1$."],["2\n1 4\n2 3","No\n\nThere is a moment when both Person $1$ and Person $2$ were on the elevator. Since $C_1 = 2, C_2 = 0$, some of the information is incorrect."],["2\n4 1\n2 4","No\n\nThe records are seemingly intact but clearly are incorrect."]],"created_at":"2026-03-03 11:01:14"}}