DWITE Contest

Test Case for Question #3 in DWITE 2009-2010 High School Round 5

Contest: DWITE 2009-2010 High School Round 5
Question: #3
Input File: DATA3.txt
Output File: OUT3.txt


Input

1
1
foo 42
foo 41
---
2
2
bar 1
foo 42
bar 2
baz 40
---
2
1
bar 1
foo 2
foo 2
---
2
1
bar 1
foo 2
bar 2
---
3
3
bar 1
baz 1
foo 1
bar 1
baz 1
foo 1
---




Output

0 1
2 1
1 0
1 1
0 0