{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cspan lang\u003d\"en-us\"\u003e\u003cp\u003eVladimir worked for years making matrioshkas, those nesting dolls that certainly represent truly Russian craft. A matrioshka is a doll that may be opened in two halves, so that one finds another doll inside. Then this doll may be opened to find another one inside it. This can be repeated several times, till a final doll – that cannot be opened – is reached.\u003c/p\u003e\u003cp\u003eRecently, Vladimir realized that the idea of nesting dolls might be generalized to nesting toys. Indeed, he has designed toys that contain toys but in a more general sense. One of these toys may be opened in two halves and it may have more than one toy inside it. That is the new feature that Vladimir wants to introduce in his new line of toys.\u003c/p\u003e\u003cp\u003eVladimir has developed a notation to describe how nesting toys should be constructed. A toy is represented with a positive integer, according to its size. More precisely: if when opening the toy represented by \u003ci\u003e m\u003c/i\u003e we find the toys represented by \u003ci\u003en\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e, \u003ci\u003en\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e, …, \u003ci\u003en\u003csub\u003er\u003c/sub\u003e\u003c/i\u003e, it must be true that \u003ci\u003en\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e + \u003ci\u003en\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e + … + \u003ci\u003en\u003csub\u003er\u003c/sub\u003e\u003c/i\u003e \u0026lt; \u003ci\u003em\u003c/i\u003e. And if this is the case, we say that toy m contains directly the toys \u003ci\u003en\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e, \u003ci\u003en\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e, …, \u003ci\u003en\u003csub\u003er\u003c/sub\u003e\u003c/i\u003e. It should be clear that toys that may be contained in any of the toys \u003ci\u003en\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e, \u003ci\u003en\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e, …, \u003ci\u003en\u003csub\u003er\u003c/sub\u003e\u003c/i\u003e are not considered as directly contained in the toy \u003ci\u003em\u003c/i\u003e.\u003c/p\u003e\u003cp\u003eA \u003ci\u003egeneralized matrioshka\u003c/i\u003e is denoted with a non-empty sequence of non zero integers of the form:\u003c/p\u003e\u003cdiv align\u003d\"center\"\u003e\u003ctable border\u003d\"0\" cellpadding\u003d\"0\" cellspacing\u003d\"0\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd width\u003d\"32\" align\u003d\"center\"\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e\u003c/td\u003e\u003ctd width\u003d\"32\" align\u003d\"center\"\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e\u003c/td\u003e\u003ctd width\u003d\"32\" align\u003d\"center\"\u003e\u003cspan lang\u003d\"en-us\"\u003e…\u003c/span\u003e\u003c/td\u003e\u003ctd width\u003d\"32\" align\u003d\"center\"\u003e\u003ci\u003ea\u003csub\u003eN\u003c/sub\u003e\u003c/i\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/div\u003e\u003cp\u003esuch that toy \u003ci\u003ek\u003c/i\u003e is represented in the sequence with two integers −\u003ci\u003ek\u003c/i\u003e and \u003ci\u003ek\u003c/i\u003e, with the negative one occurring in the sequence first that the positive one.\u003c/p\u003e\u003cp\u003eFor example, the sequence\u003c/p\u003e\u003cdiv align\u003d\"center\"\u003e\u003ctable border\u003d\"0\" cellpadding\u003d\"0\" cellspacing\u003d\"0\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−9\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−7\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−3\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−1\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e1\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e3\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e7\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e9\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/div\u003e\u003cp\u003erepresents a generalized matrioshka conformed by six toys, namely, 1, 2 (twice), 3, 7 and 9. Note that toy 7 contains directly toys 2 and 3. Note that the first copy of toy 2 occurs left from the second one and that the second copy contains directly a toy 1. It would be wrong to understand that the first −2 and the last 2 should be paired.\u003c/p\u003e\u003cp\u003eOn the other hand, the following sequences do not describe generalized matrioshkas:\u003c/p\u003e\u003cdiv align\u003d\"center\"\u003e\u003ctable border\u003d\"0\" cellpadding\u003d\"0\" cellspacing\u003d\"0\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−9\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−7\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−3\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−1\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e1\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e3\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e7\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e9\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/div\u003e\u003cp\u003ebecause toy 2 is bigger than toy 1 and cannot be allocated inside it.\u003c/p\u003e\u003cdiv align\u003d\"center\"\u003e\u003ctable border\u003d\"0\" cellpadding\u003d\"0\" cellspacing\u003d\"0\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−9\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−7\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−3\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−1\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e1\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e3\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e7\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e9\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/div\u003e\u003cp\u003ebecause 7 and 2 may not be allocated together inside 9.\u003c/p\u003e\u003cdiv align\u003d\"center\"\u003e\u003ctable border\u003d\"0\" cellpadding\u003d\"0\" cellspacing\u003d\"0\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−9\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−7\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−3\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−1\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e−2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e3\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e2\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e1\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e7\u003c/td\u003e\u003ctd align\u003d\"center\" width\u003d\"32\"\u003e9\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/div\u003e\u003cp\u003ebecause there is a nesting problem within toy 3.\u003c/p\u003e\u003cp\u003eYour problem is to write a program to help Vladimir telling good designs from bad ones.\u003c/p\u003e\u003c/span\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input file contains several test cases, each one of them in a separate line. Each test case is a sequence of non zero integers, each one with an absolute value less than 10\u003csup\u003e7\u003c/sup\u003e.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eOutput texts for each input case are presented in the same order that input is read.\u003c/p\u003e\u003cp\u003eFor each test case the answer must be a line of the form\u003c/p\u003e\u003cp\u003e\u003ccode\u003e:-) Matrioshka!\u003c/code\u003e\u003c/p\u003e\u003cp\u003eif the design describes a generalized matrioshka. In other case, the answer should be of the form\u003c/p\u003e\u003cp\u003e\u003ccode\u003e:-( Try again.\u003c/code\u003e\u003c/p\u003e"}},{"title":"Sample","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\u003e-9 -7 -2 2 -3 -2 -1 1 2 3 7 9\r\n-9 -7 -2 2 -3 -1 -2 2 1 3 7 9\r\n-9 -7 -2 2 -3 -1 -2 3 2 1 7 9\r\n-100 -50 -6 6 50 100\r\n-100 -50 -6 6 45 100\r\n-10 -5 -2 2 5 -4 -3 3 4 10\r\n-9 -5 -2 2 5 -4 -3 3 4 9\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e:-) Matrioshka!\r\n:-( Try again.\r\n:-( Try again.\r\n:-) Matrioshka!\r\n:-( Try again.\r\n:-) Matrioshka!\r\n:-( Try again.\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}