#include <cstdio>
#include <cstring>
#include <cassert>
const int maxq = 10000;
const int maxa = 10000;
int n, num[maxa + 1];
int qst = 0, qen = 0, q[maxq];
uint32_t st[maxq];
int main() {
assert(scanf("%d", &n) == 1);
while (n--) {
int x, com, t;
assert(scanf("%d%d%d", &com, &t, &x) == 3);
if (com == 2)
st[qen] = (uint32_t)t, q[qen++] = x;
else
num[x]++;
while (qst < qen && num[q[qst]] > 0) {
printf("%d ", t - st[qst]);
num[q[qst++]]--;
}
}
while (qst++ < qen)
printf("-1 ");
}
|