| 86 | }; |
| 87 | |
| 88 | int32_t main(){ |
| 89 | ios_base::sync_with_stdio(0); |
| 90 | cin.tie(0); |
| 91 | int q; cin >> q; |
| 92 | PersistentQueue<int> Q(q + 1); |
| 93 | while (q--) { |
| 94 | int ty; cin >> ty; |
| 95 | if (ty == 0) { |
| 96 | int id, x; cin >> id >> x; |
| 97 | Q.push(id + 1, x); |
| 98 | } |
| 99 | else { |
| 100 | int id; cin >> id; |
| 101 | cout << Q.pop(id + 1) << '\n'; |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | // https://judge.yosupo.jp/problem/persistent_queue |