Mike just got an internship at the local internet service provider, DNS. Knowing that Mike is familiar with IPs, they have asked him to implement a management system for their clients supporting a few operations. Some of those operations are client specific, while others are DNS (company) specific. Mike doesn't actually know much about IPs, so he has asked for your help.
IPs range from 0 to $$$10^9$$$ and are all initially available to all clients. There are $$$N$$$ countries (numbered from $$$0$$$ to $$$N - 1$$$), each with its own set of IPs modeled as a union of intervals. There are $$$M$$$ clients (numbered from $$$0$$$ to $$$M - 1$$$) Mike needs to help out with and $$$Q$$$ queries to answer. The queries have the following form:
Since the input and output are quite large, we recommend using fast methods of reading and writing, such as desynchronization in C++.
The first line contains integers $$$N$$$, $$$M$$$, $$$Q$$$. It is guaranteed that $$$1 \leq N \leq 10^4$$$, $$$1 \leq M \leq 10$$$, $$$1 \leq Q \leq 10^5$$$.
On the next $$$N$$$ lines, each line contains an integer $$$N_i$$$ followed by $$$2 \times N_i$$$ integers ($$$X_i^1, Y_i^1, ..., X_i^{N_i}, Y_i^{N_i}$$$) corresponding to $$$N_i$$$ intervals. Each integer is between $$$0$$$ and $$$10^9$$$. The union of these $$$N_i$$$ intervals represents the country's set of IPs. Note that $$$\sum_{i=1}^{N} N_i \leq 10^5$$$.
The next $$$Q$$$ lines describe the queries. Each of them starts with an integer $$$1 \leq type \leq 8$$$ representing the query type followed by a number of integers depending on the query type:
The output file should contain a line per query type $$$8$$$ representing the total number of visible IPs within that interval for that client.
2 1 12 1 1 100 1 500 1000 8 0 1 1000 1 0 2 800 900 8 0 1 1000 7 0 1 3 0 0 8 0 1 1000 4 0 200 400 8 0 1 1000 5 0 1 6 0 95 499 8 0 1 1000
1000 799 399 198 1000