Tách cây

View as PDF

Points: 1700 (p) Time limit: 3.0s Memory limit: 512M Input: stdin Output: stdout

Example

Sample input

10
? 1
A 1
A 1
A 2
A 4
A 2
? 4
C 2
? 1
? 4

Sample output

1
2
2
2

Comments

There are no comments at the moment.