{"raw_statement":[{"iden":"problem statement","content":"There is a $10^{100} \\times 7$ matrix $A$, where the $(i,j)$\\-th entry is $(i-1) \\times 7 + j$ for every pair of integers $(i,j)\\ (1 \\leq i \\leq 10^{100}, 1 \\leq j \\leq 7)$.\nGiven an $N \\times M$ matrix $B$, determine whether $B$ is some (unrotated) rectangular part of $A$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 10^4$\n*   $1 \\leq M \\leq 7$\n*   $1 \\leq B_{i,j} \\leq 10^9$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$B_{1,1}$ $B_{1,2}$ $\\ldots$ $B_{1,M}$\n$B_{2,1}$ $B_{2,2}$ $\\ldots$ $B_{2,M}$\n$\\hspace{1.6cm}\\vdots$\n$B_{N,1}$ $B_{N,2}$ $\\ldots$ $B_{N,M}$"},{"iden":"sample input 1","content":"2 3\n1 2 3\n8 9 10"},{"iden":"sample output 1","content":"Yes\n\nThe given matrix $B$ is the top-left $2 \\times 3$ submatrix of $A$."},{"iden":"sample input 2","content":"2 1\n1\n2"},{"iden":"sample output 2","content":"No\n\nAlthough the given matrix $B$ would match the top-left $1 \\times 2$ submatrix of $A$ after rotating $90$ degrees, the Problem Statement asks whether $B$ is an unrotated part of $A$, so the answer is `No`."},{"iden":"sample input 3","content":"10 4\n1346 1347 1348 1349\n1353 1354 1355 1356\n1360 1361 1362 1363\n1367 1368 1369 1370\n1374 1375 1376 1377\n1381 1382 1383 1384\n1388 1389 1390 1391\n1395 1396 1397 1398\n1402 1403 1404 1405\n1409 1410 1411 1412"},{"iden":"sample output 3","content":"Yes"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}