{"problem":{"name":"Tiling","description":{"content":"There is a grid of $H$ rows and $W$ columns, each cell having a side length of $1$, and we have $N$ tiles.   The $i$\\-th tile ($1\\leq i\\leq N$) is a rectangle of size $A_i\\times B_i$.   Determine whet","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc345_d"},"statements":[{"statement_type":"Markdown","content":"There is a grid of $H$ rows and $W$ columns, each cell having a side length of $1$, and we have $N$ tiles.  \nThe $i$\\-th tile ($1\\leq i\\leq N$) is a rectangle of size $A_i\\times B_i$.  \nDetermine whether it is possible to place the tiles on the grid so that all of the following conditions are satisfied:\n\n*   Every cell is covered by exactly one tile.\n*   It is fine to have unused tiles.\n*   The tiles **may be rotated or flipped when placed**. However, each tile must be aligned with the edges of the cells without extending outside the grid.\n\n## Constraints\n\n*   $1\\leq N\\leq 7$\n*   $1 \\leq H,W \\leq 10$\n*   $1\\leq A_i,B_i\\leq 10$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $H$ $W$\n$A_1$ $B_1$\n$A_2$ $B_2$\n$\\ldots$\n$A_N$ $B_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc345_d","tags":[],"sample_group":[["5 5 5\n1 1\n3 3\n4 4\n2 3\n2 5","Yes\n\nPlacing the $2$\\-nd, $4$\\-th, and $5$\\-th tiles as shown below covers every cell of the grid by exactly one tile.\n![image](https://img.atcoder.jp/abc345/0a0f2829d0485013deabba0103dbd906.png)\nHence, print `Yes`."],["1 1 2\n2 3","No\n\nIt is impossible to place the tile without letting it extend outside the grid.  \nHence, print `No`."],["1 2 2\n1 1","No\n\nIt is impossible to cover all cells with the tile.  \nHence, print `No`."],["5 3 3\n1 1\n2 2\n2 2\n2 2\n2 2","No\n\nNote that each cell must be covered by exactly one tile."]],"created_at":"2026-03-03 11:01:14"}}