{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003ccenter\u003e\r\n\t\u003ch1\u003e\r\n\t\t\u0026nbsp;\u003c/h1\u003e\r\n\u003c/center\u003e\r\n\u003cp\u003e\r\n\tThere is a bag-like data structure, supporting two operations:\u003c/p\u003e\r\n\u003cpre\u003e\r\n1 x\u003c/pre\u003e\r\n\u003cp\u003e\r\n\tThrow an element x into the bag.\u003c/p\u003e\r\n\u003cpre\u003e\r\n2\u003c/pre\u003e\r\n\u003cp\u003e\r\n\tTake out an element from the bag.\u003c/p\u003e\r\n\u003cp\u003e\r\n\tGiven a sequence of operations with return values, you\u0026#39;re going to guess the data structure. It is a stack (Last-In, First-Out), a queue (First-In, First-Out), a priority-queue (Always take out larger elements first) or something else that you can hardly imagine!\u003c/p\u003e\r\n\u003ch2\u003e\r\n\tInput\u003c/h2\u003e\r\n\u003cp\u003e\r\n\tThere are several test cases. Each test case begins with a line containing a single integer n (1\u0026lt;\u003dn\u0026lt;\u003d1000). Each of the next n lines is either a type-1 command, or an integer 2 followed by an integer x. That means after executing a type-2 command, we get an element x \u003cem\u003ewithout error\u003c/em\u003e. The value of x is always a positive integer not larger than 100. The input is terminated by end-of-file (EOF). The size of input file does not exceed 1MB.\u003c/p\u003e\r\n\u003ch2\u003e\r\n\tOutput\u003c/h2\u003e\r\n\u003cp\u003e\r\n\tFor each test case, output one of the following:\u003c/p\u003e\r\n\u003cpre\u003e\r\nstack\u003c/pre\u003e\r\n\u003cp\u003e\r\n\tIt\u0026#39;s definitely a stack.\u003c/p\u003e\r\n\u003cpre\u003e\r\nqueue\u003c/pre\u003e\r\n\u003cp\u003e\r\n\tIt\u0026#39;s definitely a queue.\u003c/p\u003e\r\n\u003cpre\u003e\r\npriority queue\u003c/pre\u003e\r\n\u003cp\u003e\r\n\tIt\u0026#39;s definitely a priority queue.\u003c/p\u003e\r\n\u003cpre\u003e\r\nimpossible\u003c/pre\u003e\r\n\u003cp\u003e\r\n\tIt can\u0026#39;t be a stack, a queue or a priority queue.\u003c/p\u003e\r\n\u003cpre\u003e\r\nnot sure\u003c/pre\u003e\r\n\u003cp\u003e\r\n\tIt can be more than one of the three data structures mentioned above.\u003c/p\u003e\r\n\u003ch2\u003e\r\n\tSample Input\u003c/h2\u003e\r\n\u003cpre\u003e\r\n6\r\n1 1\r\n1 2\r\n1 3\r\n2 1\r\n2 2\r\n2 3\r\n6\r\n1 1\r\n1 2\r\n1 3\r\n2 3\r\n2 2\r\n2 1\r\n2\r\n1 1\r\n2 2\r\n4\r\n1 2\r\n1 1\r\n2 1\r\n2 2\r\n7\r\n1 2\r\n1 5\r\n1 1\r\n1 3\r\n2 5\r\n1 4\r\n2 4\r\n\u003c/pre\u003e\r\n\u003ch2\u003e\r\n\tOutput for the Sample Input\u003c/h2\u003e\r\n\u003cpre\u003e\r\nqueue\r\nnot sure\r\nimpossible\r\nstack\r\npriority queue\r\n\u003c/pre\u003e\r\n\u003chr /\u003e\r\n\u003cp\u003e\r\n\t\u003ci\u003eRujia Liu\u003c/i\u003e\u003cbr /\u003e\r\n\t\u003ci\u003eSpecial Thanks: Yiming Li\u003c/i\u003e\u003c/p\u003e"}}]}