{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThe King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.\u003c/p\u003e\u003cp\u003eSo Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the kingdoms from $$$1$$$ to $$$n$$$. For each daughter he has compiled a list of kingdoms princes of which she wanted to marry.\u003c/p\u003e\u003cp\u003ePolycarp LXXXIV is very busy, so he finds a couple for his daughters greedily one after another.\u003c/p\u003e\u003cp\u003eFor the first daughter he takes \u003cspan class\u003d\"tex-font-style-bf\"\u003ethe kingdom with the lowest number from her list\u003c/span\u003e and marries the daughter to their prince. For the second daughter he takes \u003cspan class\u003d\"tex-font-style-bf\"\u003ethe kingdom with the lowest number from her list, prince of which hasn\u0027t been taken already\u003c/span\u003e. If there are no free princes in the list then the daughter marries nobody and Polycarp LXXXIV proceeds to the next daughter. The process ends after the $$$n$$$-th daughter.\u003c/p\u003e\u003cp\u003eFor example, let there be $$$4$$$ daughters and kingdoms, the lists daughters have are $$$[2, 3]$$$, $$$[1, 2]$$$, $$$[3, 4]$$$, $$$[3]$$$, respectively.\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/1416339c99f5d680cbd7d47df4591911?v\u003d1715873034\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e\u003cp\u003eIn that case daughter $$$1$$$ marries the prince of kingdom $$$2$$$, daughter $$$2$$$ marries the prince of kingdom $$$1$$$, daughter $$$3$$$ marries the prince of kingdom $$$3$$$, leaving daughter $$$4$$$ nobody to marry to.\u003c/p\u003e\u003cp\u003eActually, before starting the marriage process Polycarp LXXXIV has the time to convince one of his daughters that some prince is also worth marrying to. Effectively, that means that he can add exactly one kingdom to exactly one of his daughter\u0027s list. \u003cspan class\u003d\"tex-font-style-bf\"\u003eNote that this kingdom should not be present in the daughter\u0027s list.\u003c/span\u003e\u003c/p\u003e\u003cp\u003ePolycarp LXXXIV wants to increase the number of married couples.\u003c/p\u003e\u003cp\u003eUnfortunately, what he doesn\u0027t have the time for is determining what entry to add. If there is no way to increase the total number of married couples then output that the marriages are already optimal. Otherwise, find such an entry that the total number of married couples increases if Polycarp LXXXIV adds it.\u003c/p\u003e\u003cp\u003eIf there are multiple ways to add an entry so that the total number of married couples increases then print any of them.\u003c/p\u003e\u003cp\u003eFor your and our convenience you are asked to answer $$$t$$$ independent test cases.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^5$$$) — the number of test cases.\u003c/p\u003e\u003cp\u003eThen $$$t$$$ test cases follow.\u003c/p\u003e\u003cp\u003eThe first line of each test case contains a single integer $$$n$$$ ($$$1 \\le n \\le 10^5$$$) — the number of daughters and the number of kingdoms.\u003c/p\u003e\u003cp\u003eEach of the next $$$n$$$ lines contains the description of each daughter\u0027s list. The first integer $$$k$$$ ($$$0 \\le k \\le n$$$) is the number of entries in the $$$i$$$-th daughter\u0027s list. After that $$$k$$$ distinct integers follow $$$g_i[1], g_i[2], \\dots, g_i[k]$$$ ($$$1 \\le g_i[j] \\le n$$$) — the indices of the kingdoms in the list \u003cspan class\u003d\"tex-font-style-bf\"\u003ein the increasing order\u003c/span\u003e ($$$g_i[1] \u0026lt; g_i[2] \u0026lt; \\dots \u0026lt; g_i[k]$$$).\u003c/p\u003e\u003cp\u003eIt\u0027s guaranteed that the total number of daughters over all test cases does not exceed $$$10^5$$$.\u003c/p\u003e\u003cp\u003eIt\u0027s also guaranteed that the total number of kingdoms in lists over all test cases does not exceed $$$10^5$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case print the answer to it.\u003c/p\u003e\u003cp\u003ePrint \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eIMPROVE\u003c/span\u003e\" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter\u0027s list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LXXXIV should add to that daughter\u0027s list.\u003c/p\u003e\u003cp\u003eIf there are multiple ways to add an entry so that the total number of married couples increases then print any of them.\u003c/p\u003e\u003cp\u003eOtherwise the only line should contain one word \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eOPTIMAL\u003c/span\u003e\".\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eIMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.\u003c/p\u003e\u003cp\u003eIn the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.\u003c/p\u003e\u003cp\u003eIn the third and the fourth test cases there is no way to add an entry.\u003c/p\u003e\u003cp\u003eIn the fifth test case there is no way to change the marriages by adding any entry.\u003c/p\u003e"}}]}