After being bored for too long, Wesley has decided to set another geometry problem!
This time, however, it is solvable by people that do not have a -line polygon template.
Wesley will ask you queries of
different types for
polygons:
set square i
: Set theelement to a square.
set circle i
: Set theelement to a circle.
set triangle i
: Set theelement to a triangle.
get square i
: Output1
if theelement is a square or a
0
, otherwise.get circle i
: Output1
if theelement is a circle or a
0
, otherwise.get triangle i
: Output1
if theelement is a triangle or a
0
, otherwise.
Initially, all polygons are rhombuses and return
0
for all get
queries.
Can you solve Wesley's obsession with geometry?
Constraints
Subtask 1 [20%]
Subtask 2 [80%]
No additional constraints.
Input Specification
The first line will contain and
, the number of polygons and queries, respectively.
The next lines will contain one of the
queries above.
Output Specification
For each get
query, output 1
if the polygons are the same; otherwise, output 0
.
Sample Input 1
1 5
get square 1
set square 1
get square 1
set circle 1
get triangle 1
Sample Output 1
0
1
0
Sample Input 2
3 6
set square 2
set triangle 1
get square 2
set circle 3
get circle 3
get triangle 1
Sample Output 2
1
1
1
Comments