{"problem":{"name":"Coprime Solitaire","description":{"content":"We have $N$ cards arranged in a row on a table. For each $i = 1, 2, \\ldots, N$, the $i$\\-th card has an integer $A_i$ written on the front and an integer $B_i$ written on the back. Initially, every ca","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":3000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc210_f"},"statements":[{"statement_type":"Markdown","content":"We have $N$ cards arranged in a row on a table. For each $i = 1, 2, \\ldots, N$, the $i$\\-th card has an integer $A_i$ written on the front and an integer $B_i$ written on the back. Initially, every card is placed face up.\nTakahashi will choose any number of cards he likes (possibly zero) and flip them. Then, he will be happy if the following condition is satisfied:\n\n*   for every pair of integers $(i, j)$ such that $1 \\leq i \\lt j \\leq N$, the integers visible on the $i$\\-th and $j$\\-th cards are coprime.\n\nDetermine whether it is possible for Takahashi to be happy.\n\n## Constraints\n\n*   $1 \\leq N \\leq 3 \\times 10^4$\n*   $1 \\leq A_i, B_i \\leq 2 \\times 10^6$\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$\\vdots$\n$A_N$ $B_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc210_f","tags":[],"sample_group":[["3\n2 5\n10 9\n4 8","Yes\n\nInitially, we see integers $2$, $10$, and $4$. If we flip the first and second cards, we will see $5$, $9$, and $4$, which will make Takahashi happy. Thus, we should print `Yes`."],["2\n10 100\n1000 10000","No\n\nThere is no way to flip cards to make Takahashi happy, so we should print `No`."]],"created_at":"2026-03-03 11:01:14"}}