{"raw_statement":[{"iden":"statement","content":"There are $n$ rectangles in a row. You can either turn each rectangle by $90$ degrees or leave it as it is. If you turn a rectangle, its width will be height, and its height will be width. Notice that you can turn any number of rectangles, you also can turn all or none of them. **You can not change the order of the rectangles.**\n\nFind out if there is a way to make the rectangles go in order of non-ascending height. In other words, after all the turns, a height of every rectangle has to be not greater than the height of the previous rectangle (if it is such)."},{"iden":"input","content":"The first line contains a single integer $n$ ($1 \\leq n \\leq 10^5$) — the number of rectangles.\n\nEach of the next $n$ lines contains two integers $w_i$ and $h_i$ ($1 \\leq w_i, h_i \\leq 10^9$) — the width and the height of the $i$\\-th rectangle."},{"iden":"output","content":"Print \"_YES_\" (without quotes) if there is a way to make the rectangles go in order of non-ascending height, otherwise print \"_NO_\".\n\nYou can print each letter in any case (upper or lower)."},{"iden":"examples","content":"Input\n\n3\n3 4\n4 6\n3 5\n\nOutput\n\nYES\n\nInput\n\n2\n3 4\n5 5\n\nOutput\n\nNO"},{"iden":"note","content":"In the first test, you can rotate the second and the third rectangles so that the heights will be _\\[4, 4, 3\\]_.\n\nIn the second test, there is no way the second rectangle will be not higher than the first one."}],"translated_statement":[{"iden":"statement","content":"一行中有 $n$ 个矩形。你可以选择将每个矩形旋转 $90$ 度，或者保持原样。如果你旋转一个矩形，它的宽会变成高，高会变成宽。注意，你可以旋转任意数量的矩形，也可以全部旋转或一个都不旋转。*你不能改变矩形的顺序。*\n\n请判断是否存在一种方式，使得所有矩形按非递增高度排列。换句话说，在所有旋转操作之后，每个矩形的高度都不大于前一个矩形的高度（如果存在前一个矩形）。\n\n第一行包含一个整数 $n$ ($1 lt.eq n lt.eq 10^5$) —— 矩形的数量。\n\n接下来的 $n$ 行，每行包含两个整数 $w_i$ 和 $h_i$ ($1 lt.eq w_i, h_i lt.eq 10^9$) —— 第 $i$ 个矩形的宽和高。\n\n如果存在一种方式使得矩形按非递增高度排列，请输出 \"_YES_\"（不含引号），否则输出 \"_NO_\"。\n\n你可以以任意大小写形式输出每个字母。\n\n在第一个测试用例中，你可以旋转第二个和第三个矩形，使得高度变为 _[4, 4, 3]_。\n\n在第二个测试用例中，无法使第二个矩形的高度不大于第一个矩形的高度。"},{"iden":"input","content":"第一行包含一个整数 $n$ ($1 lt.eq n lt.eq 10^5$) —— 矩形的数量。接下来的 $n$ 行，每行包含两个整数 $w_i$ 和 $h_i$ ($1 lt.eq w_i, h_i lt.eq 10^9$) —— 第 $i$ 个矩形的宽和高。"},{"iden":"output","content":"如果存在一种方式使得矩形按非递增高度排列，请输出 \"_YES_\"（不含引号），否则输出 \"_NO_\"。你可以以任意大小写形式输出每个字母。"},{"iden":"examples","content":"输入33 44 63 5输出YES输入23 45 5输出NO"},{"iden":"note","content":"在第一个测试用例中，你可以旋转第二个和第三个矩形，使得高度变为 _[4, 4, 3]_。在第二个测试用例中，无法使第二个矩形的高度不大于第一个矩形的高度。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of rectangles.  \nFor each $ i \\in \\{1, \\dots, n\\} $, let $ (w_i, h_i) \\in \\mathbb{Z}^+ \\times \\mathbb{Z}^+ $ denote the original width and height of rectangle $ i $.  \n\nDefine the set of possible heights for rectangle $ i $:  \n$$ H_i = \\{w_i, h_i\\} $$  \n\nLet $ s_i \\in H_i $ be the chosen height of rectangle $ i $ after optional rotation.  \n\n**Constraints**  \n1. $ 1 \\leq n \\leq 10^5 $  \n2. $ 1 \\leq w_i, h_i \\leq 10^9 $ for all $ i \\in \\{1, \\dots, n\\} $  \n3. The sequence of chosen heights $ (s_1, s_2, \\dots, s_n) $ must satisfy:  \n   $$ s_1 \\geq s_2 \\geq \\cdots \\geq s_n $$  \n   and for each $ i $, $ s_i \\in H_i $.  \n\n**Objective**  \nDetermine whether there exists a sequence $ (s_1, \\dots, s_n) $ such that $ s_i \\in H_i $ for all $ i $ and $ s_1 \\geq s_2 \\geq \\cdots \\geq s_n $.","simple_statement":null,"has_page_source":false}