#C2299. Species Tracker

    ID: 45599 Type: Default 1000ms 256MiB

Species Tracker

Species Tracker

You are given a problem to track species sightings across different sections of a rainforest. Each operation is provided as a string. There are two types of operations:

  • Operation 1 s x: Record a sighting of the species with ID x in the section with ID s.
  • Operation 2 s: Query the unique number of species recorded in section s.

Your task is to process a sequence of such operations. When a query is issued (operation type 2), output the number of unique species in that section. Note that repeated sightings of the same species in a section are only counted once.

For any mathematical expressions, use LaTeX format. For example, the number of unique species in a section can be expressed as \(\text{unique} = |S|\) where \(S\) is the set of species IDs for that section.

inputFormat

The first line contains an integer \(Q\) representing the number of operations. The next \(Q\) lines each describe an operation in one of the following formats:

  • 1 s x — Record a sighting of species with ID \(x\) in section \(s\).
  • 2 s — Query the number of unique species in section \(s\).

outputFormat

For each query operation (operation type 2), output a single line containing the number of unique species recorded in the given section.

## sample
7
1 1 101
1 1 102
1 1 101
2 1
1 2 201
1 2 201
2 2
2

1

</p>