#include <iostream>
#include <cmath>
#include <stdio.h>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

const int maxn = 100010;
#define pb push_back
vector<long long> be, len;
map<long long, int> Map;

int m, n;

int getLast(int num){
    int lf = 0, rt = be.size() - 1;
    int ans = -1;
    while( lf <= rt ){
        int mid = (lf + rt) >>1;
        if( be[mid] <= num ){
            ans = mid;
            lf = mid + 1;
        }else
            rt = mid - 1;
    }
    return ans;
}
int getNum(int num ){
    if(Map.find(num) == Map.end() ){
        int id = getLast( num );
        int rem = (num - be[id] )% len[id];
        if( rem == 0 ) rem = len[id];
        Map[num] = getNum( rem );
    }
    return Map[num];
}

int main(){
//    freopen("in.txt", "r", stdin );
    cin>>m;
    int sum = 0;
    for(int i = 0; i < m; ++i){
        int op;
        cin>>op;
        if( op == 1 ){
            int val;
            cin>>val;
            Map[++sum] = val;
        }else{
            long long l, c;
            cin>>l>>c;
            be.pb( sum );   len.pb( l );
            sum += l * c;
        }
    }
    cin>>n;
    for(int i = 0; i < n; ++i){
        int num;
        cin>>num;
        cout<<getNum( num )<<" ";
    }
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cmath>
#include <stdio.h>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

#define pb push_back
vector<long long> be, len;
map<long long, int> Map;

int m, n;

int getLast(long long num){
    int lf = 0, rt = be.size() - 1;
    int ans = -1;
    while( lf <= rt ){
        int mid = (lf + rt) >>1;
        if( be[mid] <= num ){
            ans = mid;
            lf = mid + 1;
        }else
            rt = mid - 1;
    }
    return ans;
}
int getNum(long long num ){
    if(Map.find(num) == Map.end() ){
        int id = getLast( num );
        long long rem = (num - be[id] + 1)% len[id];
        if( rem == 0 ) rem = len[id];
        Map[num] = getNum( rem );
    }
    return Map[num];
}

int main(){
//    freopen("in.txt", "r", stdin );
    cin>>m;
    long long sum = 0;
    for(int i = 0; i < m; ++i){
        int op;
        cin>>op;
        if( op == 1 ){
            int val;
            cin>>val;
            Map[++sum] = val;
        }else{
            long long l, c;
            cin>>l>>c;
            be.pb( sum + 1);   len.pb( l );
            sum += l * c;
        }
    }
    cin>>n;
    for(int i = 0; i < n; ++i){
        long long num;
        cin>>num;
        cout<<getNum( num )<<" ";
    }
    cout<<endl;
    return 0;
}


#include "cstdio"
#include "cstring"
#include "set"
#include "utility"
#include "vector"
#include "iostream"

using namespace std;

vector<int> one;
vector<pair<long long,long long> > two;
set<pair<long long,pair<int,int> > > query;

int main(void)
{
    int m;
    scanf("%d",&m);

    long long index=0LL;

    for(int i=0;i<m;i++)
    {
        int idx;
        scanf("%d",&idx);
        if(idx==1)
        {
            int val;
            scanf("%d",&val);
            one.push_back(val);
            query.insert(make_pair(-index, make_pair(1, one.size()-1)));

            //cout << index << " 1 " << index << endl;
            index+=1LL;
        }
        else
        {
            long long l,c;
            cin >> l >> c;
            two.push_back(make_pair(l,c));
            query.insert(make_pair(-index, make_pair(2, two.size()-1)));

            //cout << index << " 2 " << index << endl;
            index+=l*c;
        }
    }

    int q;
    bool first=true;

    scanf("%d",&q);
    while(q--)
    {
        long long que;
        cin >> que;
        que--;

        while(true)
        {
            pair<int,pair<int,int> > ques;

            ques.first = -que;
            ques.second = make_pair(-1, -1);

            ques = *query.lower_bound(ques);
            pair<int,int> sec = ques.second;

            //cout << q << " " << que << " " << ques.first << endl;

            if(sec.first == 1)
            {
                if(!first)cout << " ";
                first=false;
                cout << one[sec.second];
                break;
            }
            else
            {
                pair<int,int> quez = two[sec.second];
                long long resQue = que + ques.first;
                resQue %= quez.first;
                que = resQue;
            }
        }
    }

    printf("\n");
    return 0;
}


#include "cstdio"
#include "cstring"
#include "set"
#include "utility"
#include "vector"
#include "iostream"

using namespace std;

vector<int> one;
vector<pair<long long,long long> > two;
set<pair<int,pair<int,int> > > query;

int main(void)
{
    int m;
    scanf("%d",&m);

    long long index=0LL;

    for(int i=0;i<m;i++)
    {
        int idx;
        scanf("%d",&idx);
        if(idx==1)
        {
            int val;
            scanf("%d",&val);
            one.push_back(val);
            query.insert(make_pair(-index, make_pair(1, one.size()-1)));

            //cout << index << " 1 " << index << endl;
            index+=1LL;
        }
        else
        {
            long long l,c;
            cin >> l >> c;
            two.push_back(make_pair(l,c));
            query.insert(make_pair(-index, make_pair(2, two.size()-1)));

            //cout << index << " 2 " << index << endl;
            index+=l*c;
        }
    }

    int q;
    bool first=true;

    scanf("%d",&q);
    while(q--)
    {
        long long que;
        cin >> que;
        que--;

        while(true)
        {
            pair<int,pair<int,int> > ques;

            ques.first = -que;
            ques.second = make_pair(-1, -1);

            ques = *query.lower_bound(ques);
            pair<int,int> sec = ques.second;

            //cout << q << " " << que << " " << ques.first << endl;

            if(sec.first == 1)
            {
                if(!first)cout << " ";
                first=false;
                cout << one[sec.second];
                break;
            }
            else
            {
                pair<int,int> quez = two[sec.second];
                long long resQue = que + ques.first;
                resQue %= quez.first;
                que = resQue;
            }
        }
    }

    printf("\n");
    return 0;
}


#include "cstdio"
#include "cstring"
#include "set"
#include "utility"
#include "vector"
#include "iostream"

using namespace std;

vector<int> one;
vector<pair<long long,long long> > two;
set<pair<long long,pair<int,int> > > query;

int main(void)
{
    int m;
    scanf("%d",&m);

    long long index=0LL;

    for(int i=0;i<m;i++)
    {
        int idx;
        scanf("%d",&idx);
        if(idx==1)
        {
            int val;
            scanf("%d",&val);
            one.push_back(val);
            query.insert(make_pair(-index, make_pair(1, one.size()-1)));

            //cout << index << " 1 " << index << endl;
            index+=1LL;
        }
        else
        {
            long long l,c;
            cin >> l >> c;
            two.push_back(make_pair(l,c));
            query.insert(make_pair(-index, make_pair(2, two.size()-1)));

            //cout << index << " 2 " << index << endl;
            index+=l*c;
        }
    }

    int q;
    bool first=true;

    scanf("%d",&q);
    while(q--)
    {
        long long que;
        cin >> que;
        que--;

        while(true)
        {
            pair<long long,pair<int,int> > ques;

            ques.first = -que;
            ques.second = make_pair(-1, -1);

            ques = *query.lower_bound(ques);
            pair<int,int> sec = ques.second;

            //cout << q << " " << que << " " << ques.first << endl;

            if(sec.first == 1)
            {
                if(!first)cout << " ";
                first=false;
                cout << one[sec.second];
                break;
            }
            else
            {
                pair<int,int> quez = two[sec.second];
                long long resQue = que + ques.first;
                resQue %= quez.first;
                que = resQue;
            }
        }
    }

    printf("\n");
    return 0;
}


#include "cstdio"
#include "cstring"
#include "set"
#include "utility"
#include "vector"
#include "iostream"

using namespace std;

vector<int> one;
vector<pair<long long,long long> > two;
set<pair<int,pair<int,int> > > query;

int main(void)
{
    int m;
    scanf("%d",&m);

    long long index=0LL;

    for(int i=0;i<m;i++)
    {
        int idx;
        scanf("%d",&idx);
        if(idx==1)
        {
            int val;
            scanf("%d",&val);
            one.push_back(val);
            query.insert(make_pair(-index, make_pair(1, one.size()-1)));

            //cout << index << " 1 " << index << endl;
            index+=1LL;
        }
        else
        {
            long long l,c;
            cin >> l >> c;
            two.push_back(make_pair(l,c));
            query.insert(make_pair(-index, make_pair(2, two.size()-1)));

            //cout << index << " 2 " << index << endl;
            index+=l*c;
        }
    }

    int q;
    bool first=true;

    scanf("%d",&q);
    while(q--)
    {
        long long que;
        cin >> que;
        que--;

        while(true)
        {
            pair<int,pair<int,int> > ques;

            ques.first = -que;

            ques = *query.lower_bound(ques);
            pair<int,int> sec = ques.second;

            //cout << q << " " << que << " " << ques.first << endl;

            if(sec.first == 1)
            {
                if(!first)cout << " ";
                first=false;
                cout << one[sec.second];
                break;
            }
            else
            {
                pair<int,int> quez = two[sec.second];
                long long resQue = que + ques.first;
                resQue %= quez.first;
                que = resQue;
            }
        }
    }

    printf("\n");
    return 0;
}


#include "cstdio"
#include "cstring"
#include "set"
#include "utility"
#include "vector"
#include "iostream"

using namespace std;

vector<int> one;
vector<pair<long long,long long> > two;
set<pair<int,pair<int,int> > > query;

int main(void)
{
    int m;
    scanf("%d",&m);

    long long index=0LL;

    for(int i=0;i<m;i++)
    {
        int idx;
        scanf("%d",&idx);
        if(idx==1)
        {
            int val;
            scanf("%d",&val);
            one.push_back(val);
            query.insert(make_pair(index, make_pair(1, one.size()-1)));

            //cout << index << " 1 " << index << endl;
            index+=1LL;
        }
        else
        {
            long long l,c;
            cin >> l >> c;
            two.push_back(make_pair(l,c));
            query.insert(make_pair(index, make_pair(2, two.size()-1)));

            //cout << index << " 2 " << index << endl;
            index+=l*c;
        }
    }

    int q;
    bool first=true;

    scanf("%d",&q);
    while(q--)
    {
        long long que;
        cin >> que;
        que--;

        while(true)
        {
            pair<int,pair<int,int> > ques;
            set<pair<int,pair<int,int> > >::iterator quew;

            ques.first = que;

            quew = query.upper_bound(ques);
            if((*quew).first != ques.first)
                quew--;

            ques = *quew;
            pair<int,int> sec = ques.second;

            //cout << q << " " << que << " " << ques.first << endl;

            if(sec.first == 1)
            {
                if(!first)cout << " ";
                first=false;
                cout << one[sec.second];
                break;
            }
            else
            {
                pair<int,int> quez = two[sec.second];
                long long resQue = que - ques.first;
                resQue %= quez.first;
                que = resQue;
            }
        }
    }

    printf("\n");
    return 0;
}


#include "cstdio"
#include "cstring"
#include "set"
#include "utility"
#include "vector"
#include "iostream"

using namespace std;

vector<int> one;
vector<pair<long long,long long> > two;
set<pair<int,pair<int,int> > > query;

int main(void)
{
    int m;
    scanf("%d",&m);

    long long index=0LL;

    for(int i=0;i<m;i++)
    {
        int idx;
        scanf("%d",&idx);
        if(idx==1)
        {
            int val;
            scanf("%d",&val);
            one.push_back(val);
            query.insert(make_pair(-index, make_pair(1, one.size()-1)));

            //cout << index << " 1 " << index << endl;
            index+=1LL;
        }
        else
        {
            long long l,c;
            cin >> l >> c;
            two.push_back(make_pair(l,c));
            query.insert(make_pair(-index, make_pair(2, two.size()-1)));

            //cout << index << " 2 " << index << endl;
            index+=l*c;
        }
    }

    int q;
    bool first=true;

    scanf("%d",&q);
    while(q--)
    {
        long long que;
        cin >> que;
        que--;

        while(true)
        {
            pair<int,pair<int,int> > ques;

            ques.first = -que;

            ques = *query.upper_bound(ques);
            pair<int,int> sec = ques.second;

            //cout << q << " " << que << " " << ques.first << endl;

            if(sec.first == 1)
            {
                if(!first)cout << " ";
                first=false;
                cout << one[sec.second];
                break;
            }
            else
            {
                pair<int,int> quez = two[sec.second];
                long long resQue = que - ques.first;
                resQue %= quez.first;
                que = resQue;
            }
        }
    }

    printf("\n");
    return 0;
}


#include "cstdio"
#include "cstring"
#include "set"
#include "utility"
#include "vector"
#include "iostream"

using namespace std;

vector<int> one;
vector<pair<long long,long long> > two;
set<pair<int,pair<int,int> > > query;

int main(void)
{
    int m;
    scanf("%d",&m);

    long long index=0LL;

    for(int i=0;i<m;i++)
    {
        int idx;
        scanf("%d",&idx);
        if(idx==1)
        {
            int val;
            scanf("%d",&val);
            one.push_back(val);
            query.insert(make_pair(-index, make_pair(1, one.size()-1)));

            //cout << index << " 1 " << index << endl;
            index+=1LL;
        }
        else
        {
            long long l,c;
            cin >> l >> c;
            two.push_back(make_pair(l,c));
            query.insert(make_pair(-index, make_pair(2, two.size()-1)));

            //cout << index << " 2 " << index << endl;
            index+=l*c;
        }
    }

    int q;
    bool first=true;

    scanf("%d",&q);
    while(q--)
    {
        long long que;
        cin >> que;
        que--;

        while(true)
        {
            pair<int,pair<int,int> > ques;

            ques.first = -que;

            ques = *query.upper_bound(ques);
            pair<int,int> sec = ques.second;

            //cout << q << " " << que << " " << ques.first << endl;

            if(sec.first == 1)
            {
                if(!first)cout << " ";
                first=false;
                cout << one[sec.second];
                break;
            }
            else
            {
                pair<int,int> quez = two[sec.second];
                long long resQue = que + ques.first;
                resQue %= quez.first;
                que = resQue;
            }
        }
    }

    printf("\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<cmath>
#include<algorithm>
#define inf 0x3fffffff
using namespace std;
const int maxn=100010;
int a[maxn],b[maxn],c[maxn*10],ans[maxn];
struct node
{
    int flag,x,len,bei;
}edge[maxn];
int main()
{
    int n,m,q;
    int u,v,w;
    int tol=0,sum=0,num=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&u);
        if(u==1)
        {
            edge[i].flag=u;
            scanf("%d",&edge[i].x);
        }
        else
        {
            edge[i].flag=2;
            scanf("%d %d",&edge[i].len,&edge[i].bei);

        }
    }
    scanf("%d",&q);

    for(int i=0;i<q;i++)
        scanf("%d",&b[i]);

    for (int i=0;i<n;i++)
    {
        if(edge[i].flag==1)
        {
            c[tol++]=edge[i].x;
        }
        else
        {
            for(int j=0;j<edge[i].bei;j++)
            {
                for (int k=0;k<edge[i].len;k++)
                {
                    c[tol++] = c[k];
                }
            }
        }

        if(tol>=100000)
            break;
    }

    int r=0,tmp=0,flag;
    for(int l=0;l<q;l++)
    {
        while(r<n)
        {

            if(edge[r].flag==1)
            {
                tmp++;
                if(b[l]==tmp)
                {
                    ans[sum++]=edge[r++].x;

                    break;
                }
                else
                {
                     r++;
                }
            }
            else
            {
                flag=tmp;

                tmp+=edge[r].bei*edge[r].len;
                if(tmp>=b[l])
                {
                    while(l<q)
                    {

                        if(b[l]<=tmp)
                        {
                            int snum=b[l]-flag-1;
                            ans[sum++]=c[snum%edge[r].len%100000];
                            l++;
                        }

                        else
                        {
                            r++;
                            break;
                        }
                    }
                }

                else
                {
                    r++;
                }
            }
        }
    }

    for(int i=0;i<sum;i++)
            printf("%d%c",ans[i],i==sum-1?'\n':' ');
    return 0;
}
/*2017-08-04 21:00:44.762*/


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int a[100005];
int b[100005];
int main()
{
    int n,x,y,j=0,k,l,r,Q;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d",&x);
        if(x==1)
        {
            scanf("%d",&y);
            a[j++]=y;
        }
        else
        {
            scanf("%d %d",&l,&r);
            while(r--)
            {
                for(int i=0; i<l; i++)
                {
                   a[j++]=a[i];
                }
            }
        }
    }
    scanf("%d",&Q);
    while(Q--)
    {
        scanf("%d",&k);
        printf("%d ",a[k-1]);
    }
    return 0;
}
/*2017-08-04 20:18:19.39*/


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
long long  a[1000005];
int main()
{
    long long n,x,y,j=0,k,l,r,Q;
    scanf("%I64d",&n);
    while(n--)
    {
        scanf("%I64d",&x);
        if(x==1)
        {
            scanf("%I64d",&y);
            a[j++]=y;
        }
        else
        {
            scanf("%I64d %I64d",&l,&r);
            while(r--)
            {
                for(int i=0; i<l; i++)
                {
                   a[j++]=a[i];
                }
            }
        }
    }
    scanf("%I64d",&Q);
    while(Q--)
    {
        scanf("%I64d",&k);
        printf("%I64d ",a[k-1]);
    }
    return 0;
}
/*2017-08-04 20:27:58.508*/


#include<cstdio>
#include<cstring>
#include<queue>
#include<cmath>
#include<algorithm>
#define inf 0x3fffffff
using namespace std;
typedef long long ll;
const ll maxn=1000100;
ll a[maxn],b[maxn],c[maxn],ans[maxn];
struct node
{
    ll flag,x,len,bei;
}edge[maxn];
int main()
{
    ll n,m,q;
    ll u,v,w;
    ll tol=0,sum=0,num=0;
    scanf("%I64d",&n);
    for(ll i=0;i<n;i++)
    {
        scanf("%I64d",&u);
        if(u==1)
        {
            edge[i].flag=u;
            scanf("%I64d",&edge[i].x);
        }
        else
        {
            edge[i].flag=2;
            scanf("%I64d %I64d",&edge[i].len,&edge[i].bei);

        }
    }
    scanf("%I64d",&q);

    for(ll i=0;i<q;i++)
        scanf("%I64d",&b[i]);

    for (ll i=0;i<n;i++)
    {
        if(edge[i].flag==1)
        {
            c[tol++]=edge[i].x;
        }
        else
        {
            for(ll j=0;j<edge[i].bei;j++)
            {
                for (ll k=0;k<edge[i].len;k++)
                {
                    c[tol++] = c[k];
                }
            }
        }

        if(tol>=100000)
            break;
    }

    ll r=0,tmp=0,flag;
    for(ll l=0;l<q;l++)
    {
        while(r<n)
        {

            if(edge[r].flag==1)
            {
                tmp++;
                if(b[l]==tmp)
                {
                    ans[sum++]=edge[r].x;
                    r++;
                    break;
                    //break;
                }
                r++;

            }
            else
            {
                flag=tmp;

                tmp+=edge[r].bei*edge[r].len;
                if(tmp>=b[l])
                {
                    while(l<q)
                    {

                        if(b[l]<=tmp)
                        {
                            ll snum=b[l]-flag-1;
                            ans[sum++]=c[snum%edge[r].len];
                            l++;
                            if(l==q)goto
                                end;
                        }

                        else
                        {
                            r++;
                            break;
                        }
                    }
                }

                else
                {
                    r++;
                }
            }
        }
    }
    end:
    for(ll i=0;i<sum;i++)
            printf("%I64d%c",ans[i],i==sum-1?'\n':' ');
    return 0;
}
/*2017-08-04 21:18:00.917*/


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<queue>
#include<set>
#include<algorithm>
using namespace std;
struct node
{
    int op;
    long long index;
    int pre;
    int x;
    bool operator<(const node &b)const
    {
        return index<b.index;
    }
} p,q,t;
set<node>st;
set<node>::iterator s;
int pre[1000005];
int main()
{
    int i,j,n,m,sum=0,s1=0,s2=0,x,op,flag=0;
    long long len=0,d,y,c,l;
    scanf("%d",&m);
    for(i=1; i<=m; i++)
    {
        scanf("%d",&op);
        if(op==1)
        {
            scanf("%d",&x);
            len++;
            if(len<=100005)
                pre[len]=x;
            p.index=len;
            p.x=x;
            p.op=1;
            st.insert(p);
        }
        else
        {
            scanf("%I64d%I64d",&y,&c);
            l=len;
            len+=y*c;
            p.index=len;
            p.x=c;
            p.op=2;
            p.pre=y;
            st.insert(p);
            while(c--)
            {
                if(l>=100004)
                    break;
                for(j=1; j<=y; j++)
                {
                    l++;
                    if(l>=100004)
                        break;
                    pre[l]=pre[j];
                }
            }
        }
    }
    scanf("%d",&n);
    while(n--)
    {
        scanf("%I64d",&q.index);
        s=st.lower_bound(q);
        p=*s;
        if(p.index==q.index)
        {
            if(p.op==1)
            {
                if(flag++)
                    printf(" ");
                printf("%d",p.x);
            }
            else
            {
                if(flag++)
                    printf(" ");
                printf("%d",pre[p.pre]);
            }
        }
        else
        {
            s--;
            t=*s;
            d=q.index-t.index;
            d=(d-1)%p.pre+1;
            // printf("d=%d\n",d);
            if(flag++)
                printf(" ");
            printf("%d",pre[d]);
        }
    }
    return 0;
}
/*2017-08-04 19:57:53.247*/


#include<cstdio>
#include<cstring>
#include<queue>
#include<cmath>
#include<algorithm>
#define inf 0x3fffffff
using namespace std;
typedef long long ll;
const ll maxn=100010;
ll a[maxn],b[maxn],c[maxn],ans[maxn];
struct node
{
    ll flag,x,len,bei;
}edge[maxn];
int main()
{
    ll n,m,q;
    ll u,v,w;
    ll tol=0,sum=0,num=0;
    scanf("%I64d",&n);
    for(ll i=0;i<n;i++)
    {
        scanf("%I64d",&u);
        if(u==1)
        {
            edge[i].flag=u;
            scanf("%I64d",&edge[i].x);
        }
        else
        {
            edge[i].flag=2;
            scanf("%I64d %I64d",&edge[i].len,&edge[i].bei);

        }
    }
    scanf("%I64d",&q);

    for(ll i=0;i<q;i++)
        scanf("%I64d",&b[i]);

    for (ll i=0;i<n;i++)
    {
        if(edge[i].flag==1)
        {
            c[tol++]=edge[i].x;
        }
        else
        {
            for(ll j=0;j<edge[i].bei;j++)
            {
                for (ll k=0;k<edge[i].len;k++)
                {
                    c[tol++] = c[k];
                }
            }
        }

        if(tol>=100000)
            break;
    }

    ll r=0,tmp=0,flag;
    for(ll l=0;l<q;l++)
    {
        while(r<n)
        {

            if(edge[r].flag==1)
            {
                tmp++;
                if(b[l]==tmp)
                {
                    ans[sum++]=edge[r++].x;

                    break;
                }
                else
                {
                     r++;
                }
            }
            else
            {
                flag=tmp;

                tmp+=edge[r].bei*edge[r].len;
                if(tmp>=b[l])
                {
                    while(l<q)
                    {

                        if(b[l]<=tmp)
                        {
                            ll snum=b[l]-flag-1;
                            ans[sum++]=c[snum%edge[r].len];
                            l++;
                        }

                        else
                        {
                            r++;
                            break;
                        }
                    }
                }

                else
                {
                    r++;
                }
            }
        }
    }

    for(ll i=0;i<sum;i++)
            printf("%I64d%c",ans[i],i==sum-1?'\n':' ');
    return 0;
}
/*2017-08-04 21:07:45.685*/


#include<cstdio>
#include<cstring>
#include<queue>
#include<cmath>
#include<algorithm>
#define inf 0x3fffffff
using namespace std;
typedef long long ll;
const ll maxn=1000100;
ll a[maxn],b[maxn],c[maxn*5],ans[maxn];
struct node
{
    ll flag,x,len,bei;
}edge[maxn];
int main()
{
    ll n,m,q;
    ll u,v,w;
    ll tol=0,sum=0,num=0;
    scanf("%I64d",&n);
    for(ll i=0;i<n;i++)
    {
        scanf("%I64d",&u);
        if(u==1)
        {
            edge[i].flag=u;
            scanf("%I64d",&edge[i].x);
        }
        else
        {
            edge[i].flag=2;
            scanf("%I64d %I64d",&edge[i].len,&edge[i].bei);

        }
    }
    scanf("%I64d",&q);

    for(ll i=0;i<q;i++)
        scanf("%I64d",&b[i]);

    for (ll i=0;i<n;i++)
    {
        if(edge[i].flag==1)
        {
            c[tol++]=edge[i].x;
        }
        else
        {
            for(ll j=0;j<edge[i].bei;j++)
            {
                for (ll k=0;k<edge[i].len;k++)
                {
                    c[tol++] = c[k];
                }
            }
        }

        if(tol>=100000)
            break;
    }

    ll r=0,tmp=0,flag;
    for(ll l=0;l<q;)
    {
        while(r<n)
        {

            if(edge[r].flag==1)
            {
                tmp++;
                if(b[l]==tmp)
                {
                    ans[sum++]=edge[r].x;
                    r++;
                    l++;
                    break;
                    //break;
                }
                r++;

            }
            else
            {
                flag=tmp;

                tmp+=edge[r].bei*edge[r].len;
                if(tmp>=b[l])
                {
                    while(l<q)
                    {

                        if(b[l]<=tmp)
                        {
                            ll snum=b[l]-flag-1;
                            ans[sum++]=c[snum%edge[r].len%100000];
                            l++;
                            if(l==q)goto
                                end;
                        }

                        else
                        {
                            r++;
                            break;
                        }
                    }
                }

                else
                {
                    r++;
                }
            }
        }
    }
    end:
    for(ll i=0;i<sum;i++)
            printf("%I64d%c",ans[i],i==sum-1?'\n':' ');
    return 0;
}
/*2017-08-04 21:21:29.548*/


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int a[1000005];
int main()
{
    int n,x,y,j=0,k,l,r,Q;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d",&x);
        if(x==1)
        {
            scanf("%d",&y);
            a[j++]=y;
        }
        else
        {
            scanf("%d %d",&l,&r);
            while(r--)
            {
                for(int i=0; i<l; i++)
                {
                   a[j++]=a[i];
                }
            }
        }
    }
    scanf("%d",&Q);
    while(Q--)
    {
        scanf("%d",&k);
        printf("%d ",a[k-1]);
    }
    return 0;
}/*2017-08-04 20:24:04.267*/


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#define ff first
#define ss second

using namespace std;

typedef long long ll;

int m;
pair<int,int> que[111111];
vector <pair<int,int> > pos;
ll sz[111111];

int solve(int k)
{
    int p = lower_bound(sz, sz+m+1, k)-sz-1;
    if(que[p].ff == -1) return que[p].second;
    int ki = (k - sz[p] - 1)%que[p].ff;
    return solve(ki+1);
}

int main()
{
    int n, x, l, c;
    ll k;
    cin >> m;
    sz[0] = 0;
    for(int i=0;i<m;i++)
    {
        cin >> k;
        if(k == 1)
        {
            cin >> x;
            sz[i+1] = sz[i] + 1;
            que[i] = make_pair(-1,x);
            pos.push_back(make_pair(sz[i]-1,x));
        }
        else
        {
            cin >> l >> c;
            sz[i+1] = sz[i] + l*c;
            que[i] = make_pair(l,c);
        }
    }
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> k;
        cout << solve(k) << " ";
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#define ff first
#define ss second

using namespace std;

typedef long long ll;

int m;
pair<int,int> que[111111];
ll sz[111111];

int solve(int k)
{
    int p = lower_bound(sz, sz+m+1, k)-sz-1;
    if(que[p].ff == -1) return que[p].second;
    int ki = (k - sz[p] - 1)%que[p].ff;
    return solve(ki+1);
}

int main()
{
    int n, x, l, c;
    ll k;
    cin >> m;
    sz[0] = 0;
    for(int i=0;i<m;i++)
    {
        cin >> k;
        if(k == 1)
        {
            cin >> x;
            sz[i+1] = sz[i] + 1;
            que[i] = make_pair(-1,x);
            pos.push_back(make_pair(sz[i]-1,x));
        }
        else
        {
            cin >> l >> c;
            sz[i+1] = sz[i] + l*c;
            que[i] = make_pair(l,c);
        }
    }
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> k;
        cout << solve(k) << " ";
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#define ff first
#define ss second

using namespace std;

typedef long long ll;

int m;
pair<int,int> que[111111];
vector <pair<int,int> > pos;
int sz[111111];
map <int,int> memo;

int solve(int k)
{
    if(memo.count(k)) return memo[k];
    int p = lower_bound(sz, sz+m+1, k)-sz-1;
    if(que[p].ff == -1) return memo[k] = que[p].second;
    int ki = (k - sz[p] - 1)%que[p].ff;
    return solve(ki+1);
}

int main()
{
    int n, x, l, c;
    ll k;
    cin >> m;
    sz[0] = 0;
    for(int i=0;i<m;i++)
    {
        cin >> k;
        if(k == 1)
        {
            cin >> x;
            sz[i+1] = sz[i] + 1;
            que[i] = make_pair(-1,x);
            pos.push_back(make_pair(sz[i]-1,x));
        }
        else
        {
            cin >> l >> c;
            sz[i+1] = sz[i] + l*c;
            que[i] = make_pair(l,c);
        }
    }
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> k;
        cout << solve(k) << " ";
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#define ff first
#define ss second

using namespace std;

typedef long long ll;

int m;
pair<int,int> que[111111];
int sz[111111];
map <int,int> memo;

int main()
{
    int n, x, l, c;
    ll k;
    cin >> m;
    sz[0] = 0;
    for(int i=0;i<m;i++)
    {
        cin >> k;
        if(k == 1)
        {
            cin >> x;
            sz[i+1] = sz[i] + 1;
            que[i] = make_pair(-1,x);
            memo[sz[i+1]] = x;
        }
        else
        {
            cin >> l >> c;
            sz[i+1] = sz[i] + l*c;
            que[i] = make_pair(l,c);
        }
    }
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> k;
        while(1)
        {
            if(memo.count(k)) break;
            int p = lower_bound(sz, sz+m+1, k)-sz-1;
            if(que[p].ff == -1)
            {
                memo[k] = que[p].second;
                break;
            }
            k = (k - sz[p] - 1)%que[p].ff + 1;
        }
        cout << memo[k] << " ";
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#define ff first
#define ss second

using namespace std;

typedef long long ll;

int m;
pair<int,int> que[111111];
vector <pair<ll,int> > pos;
ll sz[111111];

int solve(int k)
{
    int p = lower_bound(sz, sz+m+1, k)-sz-1;
    if(que[p].ff == -1) return que[p].second;
    int ki = (k - sz[p] - 1)%que[p].ff;
    return solve(ki+1);
}

int main()
{
    int n, x, l, c;
    ll k;
    cin >> m;
    sz[0] = 0;
    for(int i=0;i<m;i++)
    {
        cin >> k;
        if(k == 1)
        {
            cin >> x;
            sz[i+1] = sz[i] + 1;
            que[i] = make_pair(-1,x);
            pos.push_back(make_pair(sz[i]-1,x));
        }
        else
        {
            cin >> l >> c;
            sz[i+1] = sz[i] + l*c;
            que[i] = make_pair(l,c);
        }
    }
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> k;
        cout << solve(k) << " ";
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#define ff first
#define ss second

using namespace std;

typedef long long ll;

int m;
pair<int,int> que[111111];
ll sz[111111];
map <ll,int> memo;

int main()
{
    int n, x;
    ll k, l, c;
    cin >> m;
    sz[0] = 0;
    for(int i=0;i<m;i++)
    {
        cin >> k;
        if(k == 1)
        {
            cin >> x;
            sz[i+1] = sz[i] + 1;
            que[i] = make_pair(-1,x);
            memo[sz[i+1]] = x;
        }
        else
        {
            cin >> l >> c;
            sz[i+1] = sz[i] + l*c;
            que[i] = make_pair(l,c);
        }
    }
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> k;
        while(1)
        {
            if(memo.count(k)) break;
            int p = lower_bound(sz, sz+m+1, k)-sz-1;
            if(que[p].ff == -1)
            {
                memo[k] = que[p].second;
                break;
            }
            k = (k - sz[p] - 1)%que[p].ff + 1;
        }
        cout << memo[k] << " ";
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#define ff first
#define ss second

using namespace std;

typedef long long ll;

int m;
pair<int,int> que[111111];
vector <pair<int,int> > pos;
int sz[111111];

int solve(int k)
{
    int p = lower_bound(sz, sz+m+1, k)-sz-1;
    if(que[p].ff == -1) return que[p].second;
    int ki = (k - sz[p] - 1)%que[p].ff;
    return solve(ki+1);
}

int main()
{
    int n, x, l, c;
    ll k;
    cin >> m;
    sz[0] = 0;
    for(int i=0;i<m;i++)
    {
        cin >> k;
        if(k == 1)
        {
            cin >> x;
            sz[i+1] = sz[i] + 1;
            que[i] = make_pair(-1,x);
            pos.push_back(make_pair(sz[i]-1,x));
        }
        else
        {
            cin >> l >> c;
            sz[i+1] = sz[i] + l*c;
            que[i] = make_pair(l,c);
        }
    }
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> k;
        cout << solve(k) << " ";
    }
    cout << endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e4;
#else
const int MAX = 1e5 + 10;
#endif

typedef long long ll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i];
    if (T[i] == 1) {
      cin >> A[i];
    } else {
      cin >> A[i] >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  REP(i, M) {
    if (top >= MAX) {
      break;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  int s = 0;
  ll t = 0;
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      REPP(j, s, M) {
        if (T[j] == 1) {
          if (C[j] == t) {
            cout << R[t];
          }
          t++;
        } else {
          ll tmp = t;
          while (true) {
            int ii = j;
            ll b = t, e = t + A[ii] * B[ii];

            if (b <= C[i] && C[i] <= e) {
              while (e < MAX) {
                e-=A[j];
              }
              cout << R[e] << " ";
              break;
            }

            if (ii > 0) {
              ii--;
              t -= A[ii] * B[ii];
            } else {
              break;
            }
          }
          t = tmp + A[j] * B[j];
        }
        s++;
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 10;
#else
const int MAX = 300;
#endif

static void solve(string A, string B)
{
  string LCS[MAX][MAX];
  int N = SZ(A), M = SZ(B);
  REP(i, N) {
    REP(j, M) {
      if (A[i] == B[j]) {
        LCS[i + 1][j + 1] = LCS[i][j] + A[i];
      } else if (SZ(LCS[i + 1][j]) > SZ(LCS[i][j + 1])) {
        LCS[i + 1][j + 1] = LCS[i + 1][j];
      } else {
        LCS[i + 1][j + 1] = LCS[i][j + 1];
      }
    }
  }
  cout << LCS[N][M] << "\n";
}

int main(int argc, char *argv[])
{
#ifdef DK
  ifstream file("in.txt");
#else
  ifstream file(argv[1]);
#endif
  while (!file.eof()) {
    string T;
    getline(file, T);
    if (SZ(T) > 0 && T[0] != '\n') {
      size_t idx = T.find(";");
      if (idx != string::npos) {
        string A = T.substr(0, idx);
        string B = T.substr(idx + 1, SZ(T));
        solve(A, B);
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e5;
#else
const int MAX = 1e5 + 10;
#endif

typedef unsigned long long ll;
typedef pair<ll, ll> pll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

static bool c1(const pll & a, const pll & b)
{
  return a.F < b.F;
}

static bool c2(const pair<ll, pll> & a, const pair<ll, pll> & b)
{
  ll x = b.F;
  ll y = b.F + b.S.F * b.S.S;

  return x <= a.F && a.F <= y;
}

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i] >> A[i];
    if (T[i] == 2) {
      cin >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  vector<pll> M1;
  vector<pair<ll, pll> > M2;
  ll p = 0;
  REP(i, M) {
    if (T[i] == 1) {
      M1.PB(MP(p, A[i]));
      p++;
    } else {
      M2.PB(MP(p, MP(A[i], B[i])));
      p += A[i] * B[i];
    }
    if (top >= MAX) {
      continue;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      pll p = *lower_bound(M1.begin(), M1.end(), MP(C[i], 0), c1);
      if (p.F == C[i]) {
        cout << p.S << " ";
      } else {
        ll a = 0, b = SZ(M2);

        while (a < b) {
          ll m = a + (b - a) / 2;

          if (C[i] > M2[m].F + M2[m].S.F * M2[m].S.S) {
            a = m + 1;
          } else {
            b = m;
          }
        }

        pair<ll, pll> pp = M2[a];

        cout << R[C[i] % pp.S.F] << " ";
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 20;
#else
const int MAX = 1e5 + 10;
#endif

int T[MAX], A[MAX], B[MAX], C[MAX], R[MAX], top;

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    RI(T[i]);
    if (T[i] == 1) {
      RI(A[i]);
    } else {
      RII(A[i], B[i]);
    }
  }
  DRI(N);
  REP(i, N) RI(C[i]);
  REP(i, M) {
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      int ned = A[i] * B[i];
      int can = min(MAX - top, ned);
      REP(j, can) {
        R[top++] = R[j];
      }
    }
  }
  REP(i, N) printf("%d ", R[C[i] - 1]);
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e5;
#else
const int MAX = 1e5 + 10;
#endif

typedef unsigned long long ll;
typedef pair<ll, ll> pll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

static bool c1(const pll & a, const pll & b)
{
  return a.F < b.F;
}

static bool c2(const pair<ll, pll> & a, const pair<ll, pll> & b)
{
  return a.F + a.S.F * a.S.S < b.F;
//  return a.F < b.F;
}

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i] >> A[i];
    if (T[i] == 2) {
      cin >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  vector<pll> M1;
  vector<pair<ll, pll> > M2;
  ll p = 0;
  REP(i, M) {
    if (T[i] == 1) {
      M1.PB(MP(p, A[i]));
      p++;
    } else {
      M2.PB(MP(p, MP(A[i], B[i])));
      p += A[i] * B[i];
    }
    if (top >= MAX) {
      continue;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      pll p = *lower_bound(M1.begin(), M1.end(), MP(C[i], 0), c1);
      if (p.F == C[i]) {
        cout << p.S << " ";
      } else {
        vector<pair<ll, pll> >::iterator it = lower_bound(M2.begin(), M2.end(), MP(C[i], MP(1, 1)), c2);
        if (it != M2.end()) {
          pair<ll, pll> pp = *it;
          cout << R[C[i] % pp.S.F] << " ";
        }
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 20;
#else
const int MAX = 4e5 + 10;
#endif

int T[MAX], A[MAX], B[MAX], C[MAX], R[MAX], top;

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    RI(T[i]);
    if (T[i] == 1) {
      RI(A[i]);
    } else {
      RII(A[i], B[i]);
    }
  }
  DRI(N);
  REP(i, N) RI(C[i]);
  REP(i, M) {
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      int ned = A[i] * B[i];
      int can = min(N - top, ned);
      REP(j, can) {
        R[top++] = R[j];
      }
    }
  }
  REP(i, top) printf("%d ", R[i]);
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e4;
#else
const int MAX = 1e5 + 10;
#endif

typedef long long ll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i];
    if (T[i] == 1) {
      cin >> A[i];
    } else {
      cin >> A[i] >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  REP(i, M) {
    if (top >= MAX) {
      break;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  int s = 0;
  ll t = 0;
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      REPP(j, s, M) {
        if (T[i] == 1) {
          t++;
          if (C[i] == t) {
            cout << R[t];
          }
        } else {
          ll b = t, e = A[i] * B[i];
          if (C[i] <= e) {
            while (e < MAX && b < e) {
              e -= R[i];
            }
            cout << R[e] << " ";
          }
          t += e;
        }
        s++;
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e5;
#else
const int MAX = 1e5 + 10;
#endif

typedef unsigned long long ll;
typedef pair<ll, ll> pll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

static bool c1(const pll & a, const pll & b)
{
  return a.F < b.F;
}

static bool c2(const pair<ll, pll> & a, const pair<ll, pll> & b)
{
  return a.F + a.S.F * a.S.S <= b.F;
}

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i] >> A[i];
    if (T[i] == 2) {
      cin >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  vector<pll> M1;
  vector<pair<ll, pll> > M2;
  ll p = 0;
  REP(i, M) {
    if (T[i] == 1) {
      M1.PB(MP(p, A[i]));
      p++;
    } else {
      M2.PB(MP(p, MP(A[i], B[i])));
      p += A[i] * B[i];
    }
    if (top >= MAX) {
      continue;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      pll p = *lower_bound(M1.begin(), M1.end(), MP(C[i], 0), c1);
      if (p.F == C[i]) {
        cout << p.S << " ";
      } else {
        pair<ll, pll> pp = *lower_bound(M2.begin(), M2.end(), MP(C[i], MP(1, 1)), c2);
        cout << R[C[i] % pp.S.F] << " ";
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e4;
#else
const int MAX = 1e5 + 10;
#endif

int T[MAX], A[MAX], B[MAX], C[MAX], R[MAX], top;

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    RI(T[i]);
    if (T[i] == 1) {
      RI(A[i]);
    } else {
      RII(A[i], B[i]);
    }
  }
  DRI(N);
  REP(i, N) RI(C[i]);
  REP(i, M) {
    if (top >= MAX) {
      break;
    }

    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) printf("%d ", R[C[i] - 1]);
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 20;
#else
const int MAX = 4e5 + 10;
#endif

int T[MAX], A[MAX], B[MAX], C[MAX], R[MAX], top;

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    RI(T[i]);
    if (T[i] == 1) {
      RI(A[i]);
    } else {
      RII(A[i], B[i]);
    }
  }
  DRI(N);
  REP(i, N) RI(C[i]);
  REP(i, M) {
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      int ned = A[i] * B[i];
      int can = min(N - top, ned);
      REP(j, can) {
        R[top++] = R[j];
      }
    }
  }
  REP(i, N) printf("%d ", R[C[i - 1]]);
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e5;
#else
const int MAX = 1e5 + 10;
#endif

typedef unsigned long long ll;
typedef pair<ll, ll> pll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

static bool c1(const pll & a, const pll & b)
{
  return a.F < b.F;
}

static bool c2(const pair<ll, pll> & a, const pair<ll, pll> & b)
{
  return a.F < b.F;
}

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i] >> A[i];
    if (T[i] == 2) {
      cin >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  vector<pll> M1;
  vector<pair<ll, pll> > M2;
  ll p = 0;
  REP(i, M) {
    if (T[i] == 1) {
      M1.PB(MP(p, A[i]));
      p++;
    } else {
      M2.PB(MP(p, MP(A[i], B[i])));
      p += A[i] * B[i];
    }
    if (top >= MAX) {
      break;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      pll p = *lower_bound(M1.begin(), M1.end(), MP(C[i], 0), c1);
      if (p.F == C[i]) {
        cout << p.S << " ";
      } else {
        pair<ll, pll> pp = *upper_bound(M2.begin(), M2.end(), MP(C[i], MP(0, 0)), c2);
        cout << R[C[i] % pp.S.F] << " ";
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e5;
#else
const int MAX = 1e5 + 10;
#endif

typedef unsigned long long ll;
typedef pair<ll, ll> pll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

static bool c1(const pll & a, const pll & b)
{
  return a.F < b.F;
}

static bool c2(const pair<ll, pll> & a, const pair<ll, pll> & b)
{
  ll x = b.F;
  ll y = b.F + b.S.F * b.S.S;

  return x <= a.F && a.F <= y;
}

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i] >> A[i];
    if (T[i] == 2) {
      cin >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  vector<pll> M1;
  vector<pair<ll, pll> > M2;
  ll p = 0;
  REP(i, M) {
    if (T[i] == 1) {
      M1.PB(MP(p, A[i]));
      p++;
    } else {
      M2.PB(MP(p, MP(A[i], B[i])));
      p += A[i] * B[i];
    }
    if (top >= MAX) {
      continue;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      pll p = *lower_bound(M1.begin(), M1.end(), MP(C[i], 0), c1);
      if (p.F == C[i]) {
        cout << p.S << " ";
      } else {
        pair<ll, pll> pp = *lower_bound(M2.begin(), M2.end(), MP(C[i], MP(1, 1)), c2);
        cout << R[C[i] % pp.S.F] << " ";
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e5;
#else
const int MAX = 1e5 + 10;
#endif

typedef unsigned long long ll;
typedef pair<ll, ll> pll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

static bool c1(const pll & a, const pll & b)
{
  return a.F < b.F;
}

static bool c2(const pair<ll, pll> & a, const pair<ll, pll> & b)
{
  ll x = b.F;
  ll y = b.F + b.S.F * b.S.S;

  return x <= a.F && a.F <= y;
}

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i] >> A[i];
    if (T[i] == 2) {
      cin >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  vector<pll> M1;
  vector<pair<ll, pll> > M2;
  ll p = 0;
  REP(i, M) {
    if (T[i] == 1) {
      M1.PB(MP(p, A[i]));
      p++;
    } else {
      M2.PB(MP(p, MP(A[i], B[i])));
      p += A[i] * B[i];
    }
    if (top >= MAX) {
      continue;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
      continue;
    }
    ll a = 0, b = SZ(M1);
    while (a < b) {
      ll m = a + (b - a) / 2;
      if (C[i] < M1[m].F) {
        b = m;
      } else {
        a = m + 1;
      }
    }
    if (M1[a].F == C[i]) {
      cout << M1[a].S << " ";
      continue;
    }
    a = 0, b = SZ(M2);
    while (a < b) {
      ll m = a + (b - a) / 2;
      if (C[i] > M2[m].F + M2[m].S.F * M2[m].S.S) {
        a = m + 1;
      } else {
        b = m;
      }
    }
    cout << R[C[i] % M2[a].S.F] << " ";
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e4;
#else
const int MAX = 1e5 + 10;
#endif

typedef long long ll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i];
    if (T[i] == 1) {
      cin >> A[i];
    } else {
      cin >> A[i] >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  REP(i, M) {
    if (top >= MAX) {
      break;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  int s = 0;
  ll t = 0;
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      REPP(j, s, M) {
        if (T[j] == 1) {
          t++;
          if (C[j] == t) {
            cout << R[t];
          }
        } else {
          ll b = t, e = A[j] * B[j];
          if (C[i] <= e) {
            while (e < MAX && b < e) {
              e -= A[j];
            }
            cout << R[e] << " ";
          }
          t += e;
        }
        s++;
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e4;
#else
const int MAX = 1e5 + 10;
#endif

typedef long long ll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i];
    if (T[i] == 1) {
      cin >> A[i];
    } else {
      cin >> A[i] >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  REP(i, M) {
    if (top >= MAX) {
      break;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  int s = 0;
  ll t = 0;
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      REPP(j, s, M) {
        if (T[j] == 1) {
          if (C[j] == t) {
            cout << R[t];
          }
          t++;
        } else {
          ll tmp = t;
          while (true) {
            ll b = t, e = t + A[j] * B[j], ii = j - 1;

            if (b <= C[i] && C[i] <= e) {
              while (e < MAX) {
                e-=A[j];
              }
              cout << R[e] << " ";
              break;
            }

            if (ii > 0) {
              t -= A[ii] * B[ii];
              ii--;
            }
          }
          t = tmp + A[j] * B[j];
        }
        s++;
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e5;
#else
const int MAX = 1e5 + 10;
#endif

typedef unsigned long long ll;
typedef pair<ll, ll> pll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

static bool c1(const pll & a, const pll & b)
{
  return a.F < b.F;
}

static bool c2(const pair<ll, pll> & a, const pair<ll, pll> & b)
{
  return a.F < b.F;
}

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i] >> A[i];
    if (T[i] == 2) {
      cin >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  vector<pll> M1;
  vector<pair<ll, pll> > M2;
  ll p = 0;
  REP(i, M) {
    if (T[i] == 1) {
      M1.PB(MP(p, A[i]));
      p++;
    } else {
      M2.PB(MP(p, MP(A[i], B[i])));
      p += A[i] * B[i];
    }
    if (top >= MAX) {
      continue;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      pll p = *lower_bound(M1.begin(), M1.end(), MP(C[i], 0), c1);
      if (p.F == C[i]) {
        cout << p.S << " ";
      } else {
        pair<ll, pll> pp = *upper_bound(M2.begin(), M2.end(), MP(C[i], MP(0, 0)), c2);
        cout << R[C[i] % pp.S.F] << " ";
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e4;
#else
const int MAX = 1e5 + 10;
#endif

typedef long long ll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i];
    if (T[i] == 1) {
      cin >> A[i];
    } else {
      cin >> A[i] >> B[i];
    }
  }
  DRI(N);
  REP(i, N) cin >> C[i];
  REP(i, M) {
    if (top >= MAX) {
      break;
    }

    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) cout << R[C[i] - 1] << " ";
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e5;
#else
const int MAX = 1e5 + 10;
#endif

typedef unsigned long long ll;
typedef pair<ll, ll> pll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

static bool c1(const pll & a, const pll & b)
{
  return a.F < b.F;
}

static bool c2(const pair<ll, pll> & a, const pair<ll, pll> & b)
{
  return a.F < b.F;
}

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i] >> A[i];
    if (T[i] == 2) {
      cin >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  vector<pll> M1;
  vector<pair<ll, pll> > M2;
  ll p = 0;
  REP(i, M) {
    if (T[i] == 1) {
      M1.PB(MP(p, A[i]));
      p++;
    } else {
      M2.PB(MP(p, MP(A[i], B[i])));
      p += A[i] * B[i];
    }
    if (top >= MAX) {
      continue;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      pll p = *lower_bound(M1.begin(), M1.end(), MP(C[i], 0), c1);
      if (p.F == C[i]) {
        cout << p.S << " ";
      } else {
        pair<ll, pll> pp = *(upper_bound(M2.begin(), M2.end(), MP(C[i], MP(1, 1)), c2) - 1);
        cout << R[C[i] % pp.S.F] << " ";
      }
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 20;
#else
const int MAX = 1e5 + 10;
#endif

int T[MAX], A[MAX], B[MAX], C[MAX], R[MAX], top;

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    RI(T[i]);
    if (T[i] == 1) {
      RI(A[i]);
    } else {
      RII(A[i], B[i]);
    }
  }
  DRI(N);
  REP(i, N) RI(C[i]);
  REP(i, M) {
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      int ned = A[i] * B[i];
      int can = min(MAX - top, ned);
      REP(j, can) {
        R[top++] = R[j];
      }
    }
  }
  REP(i, N) printf("%d ", R[C[i - 1]]);
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e5;
#else
const int MAX = 1e5 + 10;
#endif

typedef unsigned long long ll;
typedef pair<ll, ll> pll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

static bool c1(const pll & a, const pll & b)
{
  return a.F < b.F;
}

static bool c2(const pair<ll, pll> & a, const pair<ll, pll> & b)
{
  ll x = b.F;
  ll y = b.F + b.S.F * b.S.S;

  return x <= a.F && a.F <= y;
}

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i] >> A[i];
    if (T[i] == 2) {
      cin >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  vector<pll> M1;
  vector<pair<ll, pll> > M2;
  ll p = 0;
  REP(i, M) {
    if (T[i] == 1) {
      M1.PB(MP(p, A[i]));
      p++;
    } else {
      M2.PB(MP(p, MP(A[i], B[i])));
      p += A[i] * B[i];
    }
    if (top >= MAX) {
      continue;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
    } else {
      ll a = 0, b = SZ(M1);

      while (a < b) {
        ll m = a + (b - a) / 2;

        if (C[i] < M1[m].F) {
          b = m;
        } else {
          a = m + 1;
        }
      }

      if (M1[a].F == C[i]) {
        cout << M1[a].S << " ";
        continue;
      }

      a = 0, b = SZ(M2);

      while (a < b) {
        ll m = a + (b - a) / 2;

        if (C[i] > M2[m].F + M2[m].S.F * M2[m].S.S) {
          a = m + 1;
        } else {
          b = m;
        }
      }

      pair<ll, pll> pp = M2[a];

      cout << R[C[i] % pp.S.F] << " ";
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

#ifdef DK
const int MAX = 1e5;
#else
const int MAX = 1e5 + 10;
#endif

typedef unsigned long long ll;
typedef pair<ll, ll> pll;

ll T[MAX], A[MAX], B[MAX], R[MAX], top, C[MAX];

int main()
{
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  DRI(M);
  REP(i, M) {
    cin >> T[i] >> A[i];
    if (T[i] == 2) {
      cin >> B[i];
    }
  }
  DRI(N);
  REP(i, N) {
    cin >> C[i];
    C[i]--;
  }
  vector<pll> M1;
  vector<pair<ll, pll> > M2;
  ll p = 0;
  REP(i, M) {
    if (T[i] == 1) {
      M1.PB(MP(p, A[i]));
      p++;
    } else {
      M2.PB(MP(p, MP(A[i], B[i])));
      p += A[i] * B[i];
    }
    if (top >= MAX) {
      continue;
    }
    if (T[i] == 1) {
      R[top++] = A[i];
    } else {
      REP(j, B[i]) {
        REP(k, A[i]) {
          if (top < MAX) {
            R[top++] = R[k];
          }
        }
      }
    }
  }
  REP(i, N) {
    if (C[i] < MAX) {
      cout << R[C[i]] << " ";
      continue;
    }
    ll a = 0, b = SZ(M1);
    while (a < b) {
      ll m = a + (b - a) / 2;
      if (C[i] < M1[m].F) {
        b = m;
      } else {
        a = m + 1;
      }
    }
    if (M1[a].F == C[i]) {
      cout << M1[a].S << " ";
      continue;
    }
    a = 0, b = SZ(M2);
    while (a < b) {
      ll m = a + (b - a) / 2;
      if (C[i] > M2[m].F + M2[m].S.F * M2[m].S.S) {
        a = m + 1;
      } else {
        b = m;
      }
    }
    cout << R[(C[i] - M2[a].F) % M2[a].S.F] << " ";
  }
  return 0;
}


/**
Codeforces #223 - DIV II
Task: 1500
Solution after the contest
**/
#include <bits/stdc++.h>
#define space " "
#define ln "\n"
using namespace std;
typedef unsigned long long Int;

const int MAXN = (int)(1e5) + 10;

Int m, q;
Int type[MAXN];
Int l[MAXN], c[MAXN];
Int dp[MAXN];

void answerQuery(Int q);

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> m;
    for(int i = 1; i <= m; i++)
    {
        cin >> type[i] >> l[i];
        if(type[i] == 1) dp[i] = dp[i-1]+1;
        else
        {
            cin >> c[i];
            dp[i] = dp[i-1] + l[i]*c[i];
        }
    }

    cin >> q;
    for(int i = 1; i <= q; i++)
    {
        Int query;
        cin >> query;
        answerQuery(query);
    }
    cout << ln;

    return 0;
}

void answerQuery(Int q)
{
    while(true)
    {
        int left = 0, right = m, middle;
        while(left < right)
        {
            middle = (left+right)>>1;
            if(dp[middle] < q) left = middle+1;
            else right = middle;
        }
        if(type[left] == 1)
        {
            cout << l[left] << space;
            return;
        }
        q = (q - dp[left-1] - 1)%l[left]+1;
    }
    return;
}


/**
Codeforces #223 - DIV II
Task: 1500
Solution after the contest
**/
#include <bits/stdc++.h>
#define space " "
#define ln "\n"
using namespace std;

const int MAXN = (int)(1e5);

int n, q;
int currentIndex;
vector <int> v;
vector < pair <int, int> >added;

void printVector();

int main(void)
{
//    ios::sync_with_stdio(false);
//    cin.tie(NULL);
    v.push_back(-1);
    added.push_back( make_pair(-1, -1) );

    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        int command;
        cin >> command;

        if(command == 1)
        {
            int x;
            cin >> x;

            currentIndex++;
            if(currentIndex <= MAXN) v.push_back(x);
            else added.push_back( make_pair(x, currentIndex) );
        }
        else
        {
            int l, c;
            cin >> l >> c;
            if(l*c + currentIndex > MAXN) currentIndex += l*c;
            else
            {
                bool broken = false;
                currentIndex += l*c;
                for(int times = 1; times <= c; times++)
                {
                    for(int index = 1; index <= l; index++)
                    {
                        if(currentIndex > MAXN)
                        {
                            broken = true;
                            break;
                        }
                        int current = v[index];
                        //cout << "Pushing in vec -> " << current << ln;
                        v.push_back(current);
                    }
                    if(broken) break;
                }
            }
        }
        //printVector();
    }

    cin >> q;
    for(int t = 1; t <= q; t++)
    {
        int query;
        cin >> query;
        if(query <= MAXN) cout << v[query] << space;
        else
        {
            int left = 1;
            int right = added.size();
            int middle;

            while(left <= right)
            {
                middle = ((left+right) >> 1);
                if(added[middle].second < query) left = middle + 1;
                else if(added[middle].second == query) break;
                else right = middle-1;
            }

            if(added[middle].second == query) cout << added[middle].first << space;
            else
            {
                int start;
                if(added[middle].second < query) start = added[middle].second;
                else start = added[middle-1].second;
                cout << v[query - start+1] << space;
            }
        }
    }

    cout << ln;
    //printVector();
    return 0;
}

void printVector()
{
    for(int i = 1; i < v.size(); i++)
    {
        cout << v[i] << space;
    }

    cout << ln;

    return;
}


/**
Codeforces #223 - DIV II
Task: 1500
Solution after the contest
**/
#include <bits/stdc++.h>
#define space " "
#define ln "\n"
using namespace std;
typedef unsigned long long Int;

const int MAXN = (int)(1e5);

int m, q;
int type[MAXN];
int l[MAXN], c[MAXN];
Int dp[MAXN];

void answerQuery(int q);

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> m;
    for(int i = 1; i <= m; i++)
    {
        cin >> type[i] >> l[i];
        if(type[i] == 1) dp[i] = dp[i-1]+1;
        else
        {
            cin >> c[i];
            dp[i] = dp[i-1] + l[i]*c[i];
        }
    }

    cin >> q;
    for(int i = 1; i <= q; i++)
    {
        Int query;
        cin >> query;
        answerQuery(query);
    }
    cout << ln;

    return 0;
}

void answerQuery(int q)
{
    while(true)
    {
        int left = 0, right = m, middle;
        while(left < right)
        {
            middle = (left+right)>>1;
            if(dp[middle] < q) left = middle+1;
            else right = middle;
        }
        if(type[left] == 1)
        {
            cout << l[left] << space;
            return;
        }
        q = (q - dp[left-1] - 1)%l[left]+1;
    }
    return;
}


/**
Codeforces #223 - DIV II
Task: 1500
Solution after the contest
**/
#include <bits/stdc++.h>
#define space " "
#define ln "\n"
using namespace std;

const int MAXN = (int)(1e5);

int n, q;
int currentIndex;
vector <int> v;
vector < pair <int, int> >added;

void printVector();

int main(void)
{
//    ios::sync_with_stdio(false);
//    cin.tie(NULL);
    v.push_back(-1);
    added.push_back( make_pair(-1, -1) );

    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        int command;
        cin >> command;

        if(command == 1)
        {
            int x;
            cin >> x;

            currentIndex++;
            if(currentIndex <= MAXN) v.push_back(x);
            else added.push_back( make_pair(x, currentIndex) );
        }
        else
        {
            int l, c;
            cin >> l >> c;
            if(l*c + currentIndex > MAXN) currentIndex += l*c;
            else
            {
                bool broken = false;
                currentIndex += l*c;
                for(int times = 1; times <= c; times++)
                {
                    for(int index = 1; index <= l; index++)
                    {
                        if(v.size() > MAXN)
                        {
                            broken = true;
                            break;
                        }
                        int current = v[index];
                        //cout << "Pushing in vec -> " << current << ln;
                        v.push_back(current);
                    }
                    if(broken) break;
                }
            }
        }
        //printVector();
    }

    cin >> q;
    for(int t = 1; t <= q; t++)
    {
        int query;
        cin >> query;
        if(query <= MAXN) cout << v[query] << space;
        else
        {
            int left = 1;
            int right = added.size();
            int middle;

            while(left <= right)
            {
                middle = ((left+right) >> 1);
                if(added[middle].second < query) left = middle + 1;
                else if(added[middle].second == query) break;
                else right = middle-1;
            }

            if(added[middle].second == query) cout << added[middle].first << space;
            else
            {
                int start;
                if(added[middle].second < query) start = added[middle].second;
                else start = added[middle-1].second;
                cout << v[query - start+1] << space;
            }
        }
    }

    cout << ln;
    //printVector();
    return 0;
}

void printVector()
{
    for(int i = 1; i < v.size(); i++)
    {
        cout << v[i] << space;
    }

    cout << ln;

    return;
}


/**
Codeforces #223 - DIV II
Task: 1500
Solution after the contest
**/
#include <bits/stdc++.h>
#define space " "
#define ln "\n"
using namespace std;
typedef unsigned long long Int;

const int MAXN = (int)(1e5);

int m, q;
int type[MAXN];
int l[MAXN], c[MAXN];
Int dp[MAXN];

void answerQuery(int q);

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> m;
    for(int i = 1; i <= m; i++)
    {
        cin >> type[i] >> l[i];
        if(type[i] == 1) dp[i] = dp[i-1]+1;
        else
        {
            cin >> c[i];
            dp[i] = dp[i-1] + l[i]*c[i];
        }
    }

    cin >> q;
    for(int i = 1; i <= q; i++)
    {
        Int query;
        cin >> query;
        answerQuery(query);
    }
    cout << ln;

    return 0;
}

void answerQuery(int q)
{
    while(true)
    {
        int left = 1, right = m, middle;
        while(left < right)
        {
            middle = (left+right)>>1;
            if(dp[middle] < q) left = middle+1;
            else right = middle;
        }
        if(type[left] == 1)
        {
            cout << l[left] << space;
            return;
        }
        q = (q - dp[left-1] - 1)%l[left]+1;
    }
    return;
}