RPLD - Database


Gaby enjoy working in a database of a very important university, this university has students of course, each student can see as many subjects they want, however, the database suffered an attack by a group of hackers, now, Gaby needs to see the backup files, but then she noticed that some of the backup files are corrupted as well... For example, the backup file can show that a student is seeing 2 same subjects, desperate, she needs help on this task.

It is known that several students (different ones) can see the same subject, however, one single student cannot see the same subject (this would seem ridiculous), if one student sees the same subject two or more times, this test would belong to a corrupted file.

Input

First line will contain an integer T, representing the cases to evaluate, the next T cases will start with a N and R, both integers, denoting the number of students and the number of lines the database have, the next R lines contains two integers I and C, I stands for the ID of the students and C for the subject code.

Output

You will output T lines for each test case, starting with the string “Scenario #i: “ where i is the test case you're evaluating, then, you should output the string “impossible” if the database file on evaluation is corrupted and the string “possible” if its not.

Example

Input:
2
2 4
1 6102
1 6103
2 6102
2 6103

2 4
1 6102
1 6102
2 6102
2 6103

Output:
Scenario #1: possible
Scenario #2: impossible

Constraints

1 <= N <= 10000
1 <= R <= 100000
1 <= I <= N
1000 <= C <= 9999


hide comments
Vipul Pandey: 2014-01-14 19:29:57

easy!

JordanBelfort: 2014-01-05 17:10:09

easy with stl..:)

rowan hossam: 2013-07-04 01:52:02

I got WA plz help me

Ouditchya Sinha: 2013-06-17 05:57:55

set of pairs worked fine for me. :)

Bhagwat: 2013-06-10 03:18:55

STL pair rockss..:)

raunakrocks: 2013-06-08 23:47:32

try vectors..it's very esy..:P

Eduardo Nunes: 2013-04-07 14:01:02

matrix leads to SIGSEGV, use map ;-) and remember to re-initialize it after each test case

ahmed: 2013-02-12 10:26:20

got tle plz help me

Fahmi: 2012-12-30 09:17:11

i think "fillchar" in freepascal not working for 2D, change it to simple looping -> got AC

Aditya Pande: 2012-07-11 11:40:05

getting tle


Added by:david_8k
Date:2012-04-12
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem used for the RPL contest