{"raw_statement":[{"iden":"statement","content":"Sagheer is walking in the street when he comes to an intersection of two roads. Each road can be represented as two parts where each part has 3 lanes getting into the intersection (one for each direction) and 3 lanes getting out of the intersection, so we have 4 parts in total. Each part has 4 lights, one for each lane getting into the intersection (_l_ — left, _s_ — straight, _r_ — right) and a light _p_ for a pedestrian crossing.\n\n<center>![image](https://espresso.codeforces.com/db6c8e3d832c9815b7d34ad97db45605ef1a7277.png)</center>An accident is possible if a car can hit a pedestrian. This can happen if the light of a pedestrian crossing of some part and the light of a lane that can get to or from that same part are green at the same time.\n\nNow, Sagheer is monitoring the configuration of the traffic lights. Your task is to help him detect whether an accident is possible."},{"iden":"input","content":"The input consists of four lines with each line describing a road part given in a counter-clockwise order.\n\nEach line contains four integers _l_, _s_, _r_, _p_ — for the left, straight, right and pedestrian lights, respectively. The possible values are 0 for red light and 1 for green light."},{"iden":"output","content":"On a single line, print \"_YES_\" if an accident is possible, and \"_NO_\" otherwise."},{"iden":"examples","content":"Input\n\n1 0 0 1\n0 1 0 0\n0 0 1 0\n0 0 0 1\n\nOutput\n\nYES\n\nInput\n\n0 1 1 0\n1 0 1 0\n1 1 0 0\n0 0 0 1\n\nOutput\n\nNO\n\nInput\n\n1 0 0 0\n0 0 0 1\n0 0 0 0\n1 0 1 0\n\nOutput\n\nNO"},{"iden":"note","content":"In the first example, some accidents are possible because cars of part 1 can hit pedestrians of parts 1 and 4. Also, cars of parts 2 and 3 can hit pedestrians of part 4.\n\nIn the second example, no car can pass the pedestrian crossing of part 4 which is the only green pedestrian light. So, no accident can occur."}],"translated_statement":[{"iden":"statement","content":"Sagheer 在街上行走时，来到两条道路的交叉口。每条道路可以表示为两部分，每部分有 #cf_span[3] 条车道进入交叉口（每个方向一条）和 #cf_span[3] 条车道离开交叉口，因此总共有 #cf_span[4] 个部分。每个部分有 #cf_span[4] 个信号灯，分别对应进入交叉口的每条车道（#cf_span[l] — 左转，#cf_span[s] — 直行，#cf_span[r] — 右转）以及一个用于行人过街的信号灯 #cf_span[p]。\n\n如果汽车可能撞到行人，则可能发生事故。当某个部分的行人过街信号灯与能到达或离开该同一部分的车道信号灯同时为绿灯时，就可能发生这种情况。\n\n现在，Sagheer 正在监控交通灯的配置。你的任务是帮助他判断是否可能发生事故。\n\n输入包含四行，每行按逆时针顺序描述一个道路部分。\n\n每行包含四个整数 #cf_span[l], #cf_span[s], #cf_span[r], #cf_span[p] —— 分别表示左转、直行、右转和行人信号灯。可能的取值为 #cf_span[0]（红灯）和 #cf_span[1]（绿灯）。\n\n请在一行中输出 \"_YES_\"（如果可能发生事故），否则输出 \"_NO_\"。\n\n在第一个示例中，可能发生事故，因为第 #cf_span[1] 部分的汽车可能撞到第 #cf_span[1] 和第 #cf_span[4] 部分的行人。此外，第 #cf_span[2] 和第 #cf_span[3] 部分的汽车也可能撞到第 #cf_span[4] 部分的行人。\n\n在第二个示例中，没有汽车能通过第 #cf_span[4] 部分的行人过街通道，而它是唯一一个绿灯的行人信号。因此，不可能发生事故。"},{"iden":"input","content":"输入包含四行，每行按逆时针顺序描述一个道路部分。每行包含四个整数 #cf_span[l], #cf_span[s], #cf_span[r], #cf_span[p] —— 分别表示左转、直行、右转和行人信号灯。可能的取值为 #cf_span[0]（红灯）和 #cf_span[1]（绿灯）。"},{"iden":"output","content":"请在一行中输出 \"_YES_\"（如果可能发生事故），否则输出 \"_NO_\"。"},{"iden":"examples","content":"输入\n1 0 0 1\n0 1 0 0\n0 0 1 0\n0 0 0 1\n输出\nYES\n\n输入\n0 1 1 0\n1 0 1 0\n1 1 0 0\n0 0 0 1\n输出\nNO\n\n输入\n1 0 0 0\n0 0 0 1\n0 0 0 0\n1 0 1 0\n输出\nNO"},{"iden":"note","content":"在第一个示例中，可能发生事故，因为第 #cf_span[1] 部分的汽车可能撞到第 #cf_span[1] 和第 #cf_span[4] 部分的行人。此外，第 #cf_span[2] 和第 #cf_span[3] 部分的汽车也可能撞到第 #cf_span[4] 部分的行人。在第二个示例中，没有汽车能通过第 #cf_span[4] 部分的行人过街通道，而它是唯一一个绿灯的行人信号。因此，不可能发生事故。"}],"sample_group":[],"show_order":[],"formal_statement":"Let the four road parts be indexed $ i = 0, 1, 2, 3 $ in counter-clockwise order.  \nFor each part $ i $, define the traffic light states as:  \n- $ l_i \\in \\{0,1\\} $: left-turn lane light  \n- $ s_i \\in \\{0,1\\} $: straight lane light  \n- $ r_i \\in \\{0,1\\} $: right-turn lane light  \n- $ p_i \\in \\{0,1\\} $: pedestrian crossing light  \n\nAn accident is possible if there exists a part $ i $ such that $ p_i = 1 $, and at least one of the following conditions holds:  \n1. The left-turn light of part $ i $ is green: $ l_i = 1 $  \n2. The straight light of part $ i $ is green: $ s_i = 1 $  \n3. The right-turn light of part $ i $ is green: $ r_i = 1 $  \n4. The left-turn light of part $ (i-1) \\mod 4 $ is green: $ l_{(i-1) \\mod 4} = 1 $ (cars turning left from part $ i-1 $ cross pedestrian path of part $ i $)  \n5. The straight light of part $ (i-2) \\mod 4 $ is green: $ s_{(i-2) \\mod 4} = 1 $ (cars going straight from part $ i-2 $ cross pedestrian path of part $ i $)  \n6. The right-turn light of part $ (i-3) \\mod 4 $ is green: $ r_{(i-3) \\mod 4} = 1 $ (cars turning right from part $ i-3 $ cross pedestrian path of part $ i $)  \n\n**Formal condition for accident:**  \n$$\n\\exists i \\in \\{0,1,2,3\\} \\text{ such that } p_i = 1 \\text{ and } \\left( l_i \\vee s_i \\vee r_i \\vee l_{(i-1) \\bmod 4} \\vee s_{(i-2) \\bmod 4} \\vee r_{(i-3) \\bmod 4} \\right) = 1\n$$\n\nOutput \"YES\" if the above condition holds, otherwise \"NO\".","simple_statement":null,"has_page_source":false}