#include <bits/stdc++.h>
using namespace std;
int m, nq, ptr, op[100005], oa[100005][2], a[100005 * 5];
long long n, n2, q[100005];
int main() {
  scanf("%d", &m);
  for (int i = (0); i < (m); i++) {
    scanf("%d", &op[i]);
    for (int j = (0); j < (op[i]); j++) scanf("%d", &oa[i][j]);
  }
  scanf("%d", &nq);
  for (int i = (0); i < (nq); i++) scanf("%I64d", &q[i]), --q[i];
  for (int i = (0); i < (m); i++) {
    if (op[i] == 1) {
      if (n <= 100000) a[n] = oa[i][0];
      if (ptr < nq && q[ptr] == n) printf("%d ", oa[i][0]), ++ptr;
      ++n;
    } else {
      int l = oa[i][0], c = oa[i][1];
      if (n <= 100000) {
        n2 = n;
        for (int i = (0); i < (c); i++) {
          for (int j = (0); j < (l); j++) a[n++] = a[j];
          if (n >= 100000) break;
        }
        n = n2 + l * 1LL * c;
        while (ptr < nq && q[ptr] < n) {
          printf("%d ", a[(q[ptr] - n2) % l]);
          ++ptr;
        }
      } else {
        n2 = n;
        n += l * 1LL * c;
        while (ptr < nq && q[ptr] < n) {
          printf("%d ", a[(q[ptr] - n2) % l]);
          ++ptr;
        }
      }
    }
  }
  return 0;
}
