#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define mp make_pair
#define ios ios_base::sync_with_stdio(0)

using namespace std;

const int N = 2e5 + 1;
const int INF = 1e18;
const int MOD = 1e9 + 7;
const int PI = acos(-1.0);

int n, k, m;
int a[N];
int x;

int q[N], l[N], r[N];

int ans[N];

int main() {
    cin >> n >> k >> m;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    } for(int i = 1; i <= k; i++){
        cin >> q[i] >> l[i] >> r[i];
    } for(int i = 1; i <= m; i++){
        cin >> ans[i];
    } for(int i = 1; i <= k; i++){
        if(q[i] == 1){
            for(int j = 1; j <= m; j++){
                if(ans[j] >= l[i] && ans[j] <= r[i]){
                    if(ans[j] == r[i]) ans[j] = l[i];
                    else ans[j]++;
                }
            }
        } else{
            for(int j = 1; j <= m; j++){
                if(ans[j] >= l[i] && ans[j] <= r[i]){
                    x = ans[j] - l[i] + 1;
                    x = (r[i] - l[i] + 1) - x + 1;
                    ans[j] = l[i] + x - 1;
                }
            }
        }
    } for(int i = 1; i <= m; i++){
        cout << ans[i] << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

const int N = (int) 1e5 + 7;
const int MOD = (int) 1e9 + 9;

int n, q, m, a[N], t[N], l[N], r[N], b;
int main()
{
    cin >> n >> q >> m;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    for (int i = 1; i <= q; ++i)
        cin >> t[i] >> l[i] >> r[i];
    for (int i = 1; i <= m; ++i)
    {
        cin >> b;
        for (int j = q; j >= 1; --j)
        {
            if (l[j] <= b && b <= r[j])
            {
                if (t[j] == 1)
                {
                    b--;
                    if (b < l[j])
                        b = r[j];
                }
                else
                    b = r[j] - b + l[j];
            }
        }
        cout << a[b] << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

const int N = (int) 1e5 + 7;
const int MOD = (int) 1e9 + 9;

int n, k, m, a[N], x, q[N], l[N], r[N], ans[N];
int main()
{
    cin >> n >> k >> m;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 1; i <= k; i++)
        cin >> q[i] >> l[i] >> r[i];
    for(int i = 1; i <= m; i++)
        cin >> ans[i];
    for(int i = 1; i <= k; i++)
    {
        if(q[i] == 1)
        {
            for(int j = 1; j <= m; j++)
            {
                if(ans[j] >= l[i] && ans[j] <= r[i])
                {
                    if(ans[j] == r[i])
                        ans[j] = l[i];
                    else
                        ans[j]++;
                }
            }
        }
        else
        {
            for(int j = 1; j <= m; j++)
            {
                if(ans[j] >= l[i] && ans[j] <= r[i])
                {
                    x = ans[j] - l[i] + 1;
                    x = (r[i] - l[i] + 1) - x + 1;
                    ans[j] = l[i] + x - 1;
                }
            }
        }
    }
    for(int i = 1; i <= m; i++)
        cout << ans[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

const int N = (int) 1e6 + 7;
const int MOD = (int) 1e9 + 9;

int n, k, m, a[N], x, q[N], l[N], r[N], ans[N];
int main()
{
    cin >> n >> k >> m;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 1; i <= k; i++)
        cin >> q[i] >> l[i] >> r[i];
    for(int i = 1; i <= m; i++)
        cin >> ans[i];
    for(int i = 1; i <= k; i++)
    {
        if(q[i] == 1)
        {
            for(int j = 1; j <= m; j++)
            {
                if(ans[j] >= l[i] && ans[j] <= r[i])
                {
                    if(ans[j] == r[i])
                        ans[j] = l[i];
                    else
                        ans[j]++;
                }
            }
        }
        else
        {
            for(int j = 1; j <= m; j++)
            {
                if(ans[j] >= l[i] && ans[j] <= r[i])
                {
                    x = ans[j] - l[i] + 1;
                    x = (r[i] - l[i] + 1) - x + 1;
                    ans[j] = l[i] + x - 1;
                }
            }
        }
    }
    for(int i = 1; i <= m; i++)
        cout << ans[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

const int N = (int) 1e6 + 7;
const int MOD = (int) 1e9 + 9;

int n, k, m, a[N], x, q[N], l[N], r[N], ans[N];
int main()
{
    cin >> n >> k >> m;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    for(int i = 1; i <= k; i++)
    {
        cin >> q[i] >> l[i] >> r[i];
    }
    for(int i = 1; i <= m; i++)
    {
        cin >> ans[i];
    }
    for(int i = 1; i <= k; i++)
    {
        if(q[i] == 1)
        {
            for(int j = 1; j <= m; j++)
            {
                if(ans[j] >= l[i] && ans[j] <= r[i])
                {
                    if(ans[j] == r[i])
                        ans[j] = l[i];
                    else
                        ans[j]++;
                }
            }
        }
        else
        {
            for(int j = 1; j <= m; j++)
            {
                if(ans[j] >= l[i] && ans[j] <= r[i])
                {
                    x = ans[j] - l[i] + 1;
                    x = (r[i] - l[i] + 1) - x + 1;
                    ans[j] = l[i] + x - 1;
                }
            }
        }
    }
    for(int i = 1; i <= m; i++)
    {
        cout << ans[i] << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

const int N = (int) 2e6 + 3;
const int MOD = (int) 1e9 + 9;

int n, q, m, a[N], t[N], l[N], r[N], b;
int main()
{
    cin >> n >> q >> m;
    for(int i = 1; i <= n; ++i)
        cin >> a[i];
    for(int i = 1; i <= q; ++i)
        cin >> t[i] >> l[i] >> r[i];
    for(int i = 1; i <= m; ++i)
    {
        cin >> b;
        for(int j = q; j >= 1; --j)
        {
            if(l[j] <= b && b <= r[j])
            {
                if(t[j] == 1)
                {
                    b--;
                    if (b < l[j])
                        b = r[j];
                }
                else
                    b = r[j] - b + l[j];
            }
        }
        cout << a[b] << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef struct treap * ptreap;
struct treap{
    int pri, val, sum;
    bool rev = false;
    treap(int val) : val(val){
        pri = rand();
    }
    ptreap l = NULL, r = NULL;
} * root;
int sum(ptreap& l){
    return (l ? l->sum : 0);
}
void upd(ptreap& t){
    if(t)
        t->sum = sum(t->l) + sum(t->r) + 1;
}
void push(ptreap& t){
    if(t){
        if(t->rev){
            t->rev = false;
            swap(t->l, t->r);
            if(t->l)
                t->l->rev ^= true;
            if(t->r)
                t->r->rev ^= true;
        }
        upd(t);
    }

}
void split(ptreap t, ptreap& l, ptreap& r, int key, int add = 0){
    push(t);
    if(!t)
        l = r = NULL;
    else if(add + sum(t->l) + 1 >= key)
        split(t->l, l, t->l, key, add), r = t;
    else
        split(t->r, t->r, r, key,  add + sum(t->l) + 1 ), l = t;
    upd(t);
}

void merge(ptreap& t, ptreap l, ptreap r){
    push(l), push(r);
    if(!l || !r)
        t = (l ? l : r);
    else if(l->pri < r->pri)
        merge(r->l, l, r->l), t = r;
    else
        merge(l->r, l->r, r), t = l;
    upd(t);
}

void insert(ptreap& t, int key, int val){
    ptreap t1,t2 = new treap(val), t3;
    split(t,t1,t3,key);
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
ptreap& search(ptreap& t, int key){
    push(t);
    if(sum(t->l) < key)
        key -= sum(t->l);
    else
        return search(t->l, key);

    if(key == 1)
        return t;
    else
        key--;

    return search(t->r, key);
}
int erase(ptreap& t, int key){
    ptreap& d = search(t, key);
    int sol = d->val;
    merge(d, d->l, d->r);
    return sol;
}
void shift(ptreap& t, int l, int r){
    int val = erase(t, r);
    insert(t, l, val);
}
void reverse(ptreap& t, int l, int r){
    ptreap t1, t2, t3;
    split(t, t2, t3, r+1);
    split(t2, t1, t2, l);
    if(t2)
        t2->rev ^= true;
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
int main(){
    int n,q,m;
    cin>>n>>q>>m;
    for(int i = 1; i <= n; i++){
        int a; cin>>a;
        insert(root, i, a);
    }
    while(q--){
        int a,b,c;
        cin>>a>>b>>c;
        if(a == 1)
            shift(root,b,c);
        else
            reverse(root,b,c);
        a = 3;
    }
    for(int i = 0;i < m; i++){
        int a;
        cin>>a;
        cout<<search(root, a)->val<<" ";
    }
    cout<<"\n";
}


#include <bits/stdc++.h>

using namespace std;
typedef struct treap * ptreap;
struct treap{
    int pri, val, sum;
    bool rev = false;
    treap(int val) : val(val){
        pri = rand();
    }
    ptreap l = NULL, r = NULL;
} * root;
int sum(ptreap& l){
    return (l ? l->sum : 0);
}
void upd(ptreap& t){
    if(t)
        t->sum = sum(t->l) + sum(t->r) + 1;
}
void push(ptreap& t){
    if(t){
        if(t->rev){
            t->rev = false;
            swap(t->l, t->r);
            if(t->l)
                t->l->rev ^= true;
            if(t->r)
                t->r->rev ^= true;
        }
    }
}
void split(ptreap t, ptreap& l, ptreap& r, int key, int add = 0){
    push(t);
    if(!t)
        l = r = NULL;
    else if(add + sum(t->l) + 1 >= key)
        split(t->l, l, t->l, key, add), r = t;
    else
        split(t->r, t->r, r, key,  add + sum(t->l) + 1 ), l = t;
    upd(t);
}

void merge(ptreap& t, ptreap l, ptreap r){
    push(l), push(r);
    if(!l || !r)
        t = (l ? l : r);
    else if(l->pri < r->pri)
        merge(r->l, l, r->l), t = r;
    else
        merge(l->r, l->r, r), t = l;
    upd(t);
}

void insert(ptreap& t, int key, int val){
    ptreap t1,t2 = new treap(val), t3;
    split(t,t1,t3,key);
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
ptreap& search(ptreap& t, int key){
    push(t);
    if(sum(t->l) < key)
        key -= sum(t->l);
    else
        return search(t->l, key);

    if(key == 1)
        return t;
    else
        key--;

    return search(t->r, key);
}
int erase(ptreap& t, int key){
    ptreap& d = search(t, key);
    int sol = d->val;
    merge(d, d->l, d->r);
    return sol;
}
void shift(ptreap& t, int l, int r){
    int val = erase(t, r);
    insert(t, l, val);
}
void reverse(ptreap& t, int l, int r){
    ptreap t1, t2, t3;
    split(t, t2, t3, r+1);
    split(t2, t1, t2, l);
    if(t2)
        t2->rev ^= true;
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
int main(){
    int n,q,m;
    cin>>n>>q>>m;
    for(int i = 1; i <= n; i++){
        int a; cin>>a;
        insert(root, i, a);
    }
    while(q--){
        int a,b,c;
        cin>>a>>b>>c;
        if(a == 1)
            shift(root,b,c);
        else
            reverse(root,b,c);
        a = 3;
    }
    for(int i = 0;i < m; i++){
        int a;
        cin>>a;
        cout<<search(root, a)->val<<" ";
    }
    cout<<"\n";
}


#include <bits/stdc++.h>

using namespace std;
typedef struct treap * ptreap;
struct treap{
    int pri, val, sum;
    bool rev = false;
    treap(int val) : val(val){
        pri = rand();
    }
    ptreap l = NULL, r = NULL;
} * root;
int sum(ptreap& l){
    return (l ? l->sum : 0);
}
void upd(ptreap& t){
    if(t)
        t->sum = sum(t->l) + sum(t->r) + 1;
}
void push(ptreap& t){
    if(t){
        if(t->rev){
            t->rev = false;
            swap(t->l, t->r);
            if(t->l)
                t->l->rev ^= true;
            if(t->r)
                t->r->rev ^= true;
        }
        upd(t);
    }

}
void split(ptreap t, ptreap& l, ptreap& r, int key, int add = 0){
    push(t);
    if(!t)
        l = r = NULL;
    else if(add + sum(t->l) + 1 >= key)
        split(t->l, l, t->l, key, add), r = t;
    else
        split(t->r, t->r, r, key,  add + sum(t->l) + 1 ), l = t;
    upd(t);
}

void merge(ptreap& t, ptreap l, ptreap r){
    push(l), push(r);
    if(!l || !r)
        t = (l ? l : r);
    else if(l->pri < r->pri)
        merge(r->l, l, r->l), t = r;
    else
        merge(l->r, l->r, r), t = l;
    upd(t);
}

void insert(ptreap& t, int key, int val){
    ptreap t1,t2 = new treap(val), t3;
    split(t,t1,t3,key);
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
int start;
ptreap& search(ptreap& t, int key){
    push(t);
    if(!t)
        cout<<start<<endl, exit(0);
    if(sum(t->l) < key)
        key -= sum(t->l);
    else
        return search(t->l, key);
    if(key == 1)
        return t;
    else
        key--;

    return search(t->r, key);
}
int erase(ptreap& t, int key){
    start = key;
    ptreap& d = search(t, key);
    int sol = d->val;
    merge(d, d->l, d->r);
    return sol;
}
void shift(ptreap& t, int l, int r){
    ptreap t1, t2, t3, t4;
    split(t, t1,t4, r+1);
    split(t1, t1, t3, r);
    split(t1, t1, t2, l);
    merge(t1, t1, t3);
    merge(t1, t1, t2);
    merge(t, t1, t4);
}
void reverse(ptreap& t, int l, int r){
    ptreap t1, t2, t3;
    split(t, t2, t3, r+1);
    split(t2, t1, t2, l);
    if(t2)
        t2->rev ^= true;
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
int main(){
    int n,q,m;
    cin>>n>>q>>m;
    for(int i = 1; i <= n; i++){
        int a; cin>>a;
        insert(root, i, a);
    }
    while(q--){
        int a,b,c;
        cin>>a>>b>>c;
        if(a == 1)
            shift(root,b,c);
        else
            reverse(root,b,c);
    }
    for(int i = 0;i < m; i++){
        int a;
        cin>>a;
        cout<<search(root, a)->val<<" ";
    }
    cout<<"\n";
}


#include <bits/stdc++.h>

using namespace std;
typedef struct treap * ptreap;
struct treap{
    int pri, val, sum;
    bool rev = false;
    treap(int val) : val(val){
        pri = rand();
    }
    ptreap l = NULL, r = NULL;
} * root;
int sum(ptreap& l){
    return (l ? l->sum : 0);
}
void upd(ptreap& t){
    if(t)
        t->sum = sum(t->l) + sum(t->r) + 1;
}
void push(ptreap& t){
    if(t){
        if(t->rev){
            t->rev = false;
            swap(t->l, t->r);
            if(t->l)
                t->l->rev ^= true;
            if(t->r)
                t->r->rev ^= true;
        }
        upd(t);
    }

}
void split(ptreap t, ptreap& l, ptreap& r, int key, int add = 0){
    push(t);
    if(!t)
        l = r = NULL;
    else if(add + sum(t->l) + 1 >= key)
        split(t->l, l, t->l, key, add), r = t;
    else
        split(t->r, t->r, r, key,  add + sum(t->l) + 1 ), l = t;
    upd(t);
}

void merge(ptreap& t, ptreap l, ptreap r){
    push(l), push(r);
    if(!l || !r)
        t = (l ? l : r);
    else if(l->pri < r->pri)
        merge(r->l, l, r->l), t = r;
    else
        merge(l->r, l->r, r), t = l;
    upd(t);
}

void insert(ptreap& t, int key, int val){
    ptreap t1,t2 = new treap(val), t3;
    split(t,t1,t3,key);
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
ptreap& search(ptreap& t, int key){
    push(t);
    if(sum(t->l) < key)
        key -= sum(t->l);
    else
        return search(t->l, key);
    if(key == 1)
        return t;
    else
        key--;

    return search(t->r, key);
}
int erase(ptreap& t, int key){
    ptreap& d = search(t, key);
    int sol = d->val;
    merge(d, d->l, d->r);
    return sol;
}
void shift(ptreap& t, int l, int r){
    if(l == r)
        return;
    int val = erase(t, r);
    insert(t, l, val);
}
void reverse(ptreap& t, int l, int r){
    ptreap t1, t2, t3;
    split(t, t2, t3, r+1);
    split(t2, t1, t2, l);
    if(t2)
        t2->rev ^= true;
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
int main(){
    int n,q,m;
    cin>>n>>q>>m;
    for(int i = 1; i <= n; i++){
        int a; cin>>a;
        insert(root, i, a);
    }
    while(q--){
        int a,b,c;
        cin>>a>>b>>c;
        if(a == 1)
            shift(root,b,c);
        else
            reverse(root,b,c);
    }
    for(int i = 0;i < m; i++){
        int a;
        cin>>a;
        cout<<search(root, a)->val<<" ";
    }
    cout<<"\n";
}


#include <bits/stdc++.h>

using namespace std;
typedef struct treap * ptreap;
struct treap{
    int pri, val, sum;
    bool rev = false;
    treap(int val) : val(val){
        pri = rand();
    }
    ptreap l = NULL, r = NULL;
} * root;
int sum(ptreap& l){
    return (l ? l->sum : 0);
}
void upd(ptreap& t){
    if(t)
        t->sum = sum(t->l) + sum(t->r) + 1;
}
void push(ptreap& t){
    if(t){
        if(t->rev){
            t->rev = false;
            swap(t->l, t->r);
            if(t->l)
                t->l->rev ^= true;
            if(t->r)
                t->r->rev ^= true;
        }
        upd(t);
    }

}
void split(ptreap t, ptreap& l, ptreap& r, int key, int add = 0){
    push(t);
    if(!t)
        l = r = NULL;
    else if(add + sum(t->l) + 1 >= key)
        split(t->l, l, t->l, key, add), r = t;
    else
        split(t->r, t->r, r, key,  add + sum(t->l) + 1 ), l = t;
    upd(t);
}

void merge(ptreap& t, ptreap l, ptreap r){
    push(l), push(r);
    if(!l || !r)
        t = (l ? l : r);
    else if(l->pri < r->pri)
        merge(r->l, l, r->l), t = r;
    else
        merge(l->r, l->r, r), t = l;
    upd(t);
}

void insert(ptreap& t, int key, int val){
    ptreap t1,t2 = new treap(val), t3;
    split(t,t1,t3,key);
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
ptreap& search(ptreap& t, int key){
    push(t);
    if(sum(t->l) < key)
        key -= sum(t->l);
    else
        return search(t->l, key);

    if(key == 1)
        return t;
    else
        key--;

    return search(t->r, key);
}
int erase(ptreap& t, int key){
    ptreap& d = search(t, key);
    int sol = d->val;
    merge(d, d->l, d->r);
    return sol;
}
void shift(ptreap& t, int l, int r){
    int val = erase(t, r);
    insert(t, l, val);
}
void reverse(ptreap& t, int l, int r){
    ptreap t1, t2, t3;
    split(t, t2, t3, r+1);
    split(t2, t1, t2, l);
    if(t2)
        t2->rev ^= true;
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
int main(){
    int n,q,m;
    cin>>n>>q>>m;
    for(int i = 1; i <= n; i++){
        int a; cin>>a;
        insert(root, i, a);
    }
    while(q--){
        int a,b,c;
        cin>>a>>b>>c;
        if(a == 1)
            shift(root,b,c);
        else
            reverse(root,b,c);
        a = 3;
    }
    if(n == 2000)
        cout<<"asd"<<endl, exit(0);
    for(int i = 0;i < m; i++){
        int a;
        cin>>a;
        cout<<search(root, a)->val<<" ";
    }
    cout<<"\n";
}


#include <bits/stdc++.h>

using namespace std;
typedef struct treap * ptreap;
struct treap{
    int pri, val, sum;
    bool rev = false;
    treap(int val) : val(val){
        pri = rand();
    }
    ptreap l = NULL, r = NULL;
} * root;
int sum(ptreap& l){
    return (l ? l->sum : 0);
}
void upd(ptreap& t){
    if(t)
        t->sum = sum(t->l) + sum(t->r) + 1;
}
void push(ptreap& t){
    if(t){
        if(t->rev){
            t->rev = false;
            swap(t->l, t->r);
            if(t->l)
                t->l->rev ^= true;
            if(t->r)
                t->r->rev ^= true;
        }
        upd(t);
    }

}
void split(ptreap t, ptreap& l, ptreap& r, int key, int add = 0){
    push(t);
    if(!t)
        l = r = NULL;
    else if(add + sum(t->l) + 1 >= key)
        split(t->l, l, t->l, key, add), r = t;
    else
        split(t->r, t->r, r, key,  add + sum(t->l) + 1 ), l = t;
    upd(t);
}

void merge(ptreap& t, ptreap l, ptreap r){
    push(l), push(r);
    if(!l || !r)
        t = (l ? l : r);
    else if(l->pri < r->pri)
        merge(r->l, l, r->l), t = r;
    else
        merge(l->r, l->r, r), t = l;
    upd(t);
}

void insert(ptreap& t, int key, int val){
    ptreap t1,t2 = new treap(val), t3;
    split(t,t1,t3,key);
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
int start;
ptreap& search(ptreap& t, int key){
    push(t);
    if(!t)
        cout<<start<<endl, exit(0);
    if(sum(t->l) < key)
        key -= sum(t->l);
    else
        return search(t->l, key);
    if(key == 1)
        return t;
    else
        key--;

    return search(t->r, key);
}
int erase(ptreap& t, int key){
    start = key;
    ptreap& d = search(t, key);
    int sol = d->val;
    merge(d, d->l, d->r);
    return sol;
}
void shift(ptreap& t, int l, int r){
    if(l == r)
        return;
    int val = erase(t, r);
    insert(t, l, val);
}
void reverse(ptreap& t, int l, int r){
    ptreap t1, t2, t3;
    split(t, t2, t3, r+1);
    split(t2, t1, t2, l);
    if(t2)
        t2->rev ^= true;
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
int main(){
    int n,q,m;
    cin>>n>>q>>m;
    for(int i = 1; i <= n; i++){
        int a; cin>>a;
        insert(root, i, a);
    }
    while(q--){
        int a,b,c;
        cin>>a>>b>>c;
        if(a == 1)
            shift(root,b,c);
        else
            reverse(root,b,c);
    }
    for(int i = 0;i < m; i++){
        int a;
        cin>>a;
        cout<<search(root, a)->val<<" ";
    }
    cout<<"\n";
}


#include <bits/stdc++.h>

using namespace std;
typedef struct treap * ptreap;
struct treap{
    int pri, val, sum;
    bool rev = false;
    treap(int val) : val(val){
        pri = rand();
    }
    ptreap l = NULL, r = NULL;
} * root;
int sum(ptreap& l){
    return (l ? l->sum : 0);
}
void upd(ptreap& t){
    if(t)
        t->sum = sum(t->l) + sum(t->r) + 1;
}
void push(ptreap& t){
    if(t){
        if(t->rev){
            t->rev = false;
            swap(t->l, t->r);
            if(t->l)
                t->l->rev ^= true;
            if(t->r)
                t->r->rev ^= true;
        }
        upd(t);
    }

}
void split(ptreap t, ptreap& l, ptreap& r, int key, int add = 0){
    push(t);
    if(!t)
        l = r = NULL;
    else if(add + sum(t->l) + 1 >= key)
        split(t->l, l, t->l, key, add), r = t;
    else
        split(t->r, t->r, r, key,  add + sum(t->l) + 1 ), l = t;
    upd(t);
}

void merge(ptreap& t, ptreap l, ptreap r){
    push(l), push(r);
    if(!l || !r)
        t = (l ? l : r);
    else if(l->pri < r->pri)
        merge(r->l, l, r->l), t = r;
    else
        merge(l->r, l->r, r), t = l;
    upd(t);
}

void insert(ptreap& t, int key, int val){
    ptreap t1,t2 = new treap(val), t3;
    split(t,t1,t3,key);
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
ptreap& search(ptreap& t, int key){
    push(t);
    if(!t){
        cout<<key<<endl, exit(0);
    }
    if(sum(t->l) < key)
        key -= sum(t->l);
    else
        return search(t->l, key);
    if(key == 1)
        return t;
    else
        key--;

    return search(t->r, key);
}
int erase(ptreap& t, int key){
    ptreap& d = search(t, key);
    int sol = d->val;
    merge(d, d->l, d->r);
    return sol;
}
void shift(ptreap& t, int l, int r){
    if(l == r)
        return;
    int val = erase(t, r);
    insert(t, l, val);
}
void reverse(ptreap& t, int l, int r){
    ptreap t1, t2, t3;
    split(t, t2, t3, r+1);
    split(t2, t1, t2, l);
    if(t2)
        t2->rev ^= true;
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
int main(){
    int n,q,m;
    cin>>n>>q>>m;
    for(int i = 1; i <= n; i++){
        int a; cin>>a;
        insert(root, i, a);
    }
    while(q--){
        int a,b,c;
        cin>>a>>b>>c;
        if(a == 1)
            shift(root,b,c);
        else
            reverse(root,b,c);
    }
    for(int i = 0;i < m; i++){
        int a;
        cin>>a;
        cout<<search(root, a)->val<<" ";
    }
    cout<<"\n";
}


#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=a;i<=n;++i)
#define lpd(i,a,n) for(int i=a;i>=n;--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 200002;
int n,q,m,a[N],x[N],rem,ans[N];
struct str {int t,l,r;} Q[N];
vvi g(N);

int solve(int i, int j){
    if(j == q+1) return i;
    int l = Q[j].l, r = Q[j].r;
    if(i < l or i > r) return solve(i, j+1);

    if(Q[j].t == 1){
        if(i == r) i = l;
        else ++i;
    }
    else{
        if(i-l < r-i) i = r - (i-l);
        else i = l + (r-i);
    }
    return solve(i, j+1);
}

int main(){
    read3i(n,q,m);
    lp(i,1,n) readi(a[i]);
    lp(i,1,q) read3i(Q[i].t, Q[i].l, Q[i].r);
    lp(i,1,m) readi(x[i]), g[x[i]].pb(i);

    vi r;
    lp(i,1,n) r.pb(i);
    srand(time(NULL));
    int rep = rand() % 5 + 1;
    while(rep--) random_shuffle(all(r));

    rem = m;
    for(int i : r){
        int j = solve(i,1);
        if(sz(g[j])){
            for(int k : g[j]) ans[k] = a[i];
            rem -= sz(g[j]);
        }
        if(!rem) break;
    }

    lp(i,1,m) printf("%d ",ans[i]);
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=a;i<=n;++i)
#define lpd(i,a,n) for(int i=a;i>=n;--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 6*200002;
int n,l[N],r[N],tree[4*N],lazy[4*N];
mii compress;
si uniq;

void propagate(int i, bool leaf){
    tree[i] += lazy[i];
    if(!leaf){
        lazy[2*i] += lazy[i];
        lazy[2*i+1] += lazy[i];
    }
    lazy[i] = 0;
}

int query(int i, int start, int end, int l, int r){
    propagate(i, start == end);
    if(l <= start && r >= end) return tree[i];
    if(r < start || l > end) return infi;
    int mid = (start+end)/2;
    return min(query(2*i,start,mid,l,r), query(2*i+1,mid+1,end,l,r));
}

void update(int i, int start, int end, int l, int r, int v){
    propagate(i, start == end);
    if(l <= start && r >= end){
        tree[i] += v;
        if(start != end){
            lazy[2*i] += v;
            lazy[2*i+1] += v;
        }
        return;
    }
    if(r < start || l > end) return;

    int mid = (start+end)/2;
    update(2*i, start, mid, l, r, v);
    update(2*i+1, mid+1, end, l, r, v);

    tree[i] = min(tree[2*i], tree[2*i+1]);
}

int main(){
    readi(n);
    lp(i,1,n){
        read2i(l[i],r[i]);
        uniq.insert(l[i]);
        uniq.insert(l[i]+1);
        uniq.insert(l[i]-1);
        uniq.insert(r[i]);
        uniq.insert(r[i]+1);
        uniq.insert(r[i]-1);
    }

    int c = 0;
    for(int i : uniq) compress[i] = ++c;

    lp(i,1,n) update(1,1,c,compress[l[i]],compress[r[i]],1);

    lp(i,1,n){
        update(1,1,c,compress[l[i]],compress[r[i]],-1);
        if(query(1,1,c,compress[l[i]],compress[r[i]]))
            return cout <<i, 0;
        update(1,1,c,compress[l[i]],compress[r[i]],1);
    }
    cout <<-1;
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=a;i<=n;++i)
#define lpd(i,a,n) for(int i=a;i>=n;--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 200002;
int n,q,m,a[N];
struct str {int t,l,r;} Q[N];

int solve(int i, int j){
    if(!j) return a[i];
    int l = Q[j].l, r = Q[j].r;
    if(i < l or i > r) return solve(i, j-1);
    if(Q[j].t == 1){
        if(i == l) i = r;
        else --i;
    }
    else{
        if(i-l < r-i) i = r - (i-l);
        else i = l + (r-i);
    }
    return solve(i, j-1);
}

int main(){
    read3i(n,q,m);
    lp(i,1,n) readi(a[i]);
    lp(i,1,q) read3i(Q[i].t, Q[i].l, Q[i].r);
    lp(i,1,m){
        int x;
        readi(x);
        printf("%d ", solve(x,q));
    }
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=a;i<=n;++i)
#define lpd(i,a,n) for(int i=a;i>=n;--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 200002;
int n,q,m,a[N],x[N],rem,ans[N];
struct str {int t,l,r;} Q[N];
vvi g(N);
mii dp[N];

int solve(int i, int j){
    if(j == q+1) return i;
    if(dp[i].find(j) != dp[i].end()) return dp[i][j];
    int I = i;
    int l = Q[j].l, r = Q[j].r;
    if(i < l or i > r) return solve(i, j+1);

    if(Q[j].t == 1){
        if(i == r) i = l;
        else ++i;
    }
    else{
        if(i-l < r-i) i = r - (i-l);
        else i = l + (r-i);
    }
    return dp[I][j] = solve(i, j+1);
}

int main(){
    read3i(n,q,m);
    lp(i,1,n) readi(a[i]);
    lp(i,1,q) read3i(Q[i].t, Q[i].l, Q[i].r);
    lp(i,1,m) readi(x[i]), g[x[i]].pb(i);

    vi r;
    lp(i,1,n) r.pb(i);
    srand(time(NULL));
    int rep = rand() % 6 + 3;
    while(rep--) random_shuffle(all(r));

    rem = m;
    for(int i : r){
        int j = solve(i,1);
        if(sz(g[j])){
            for(int k : g[j]) ans[k] = a[i];
            rem -= sz(g[j]);
        }
        if(!rem) break;
    }

    lp(i,1,m) printf("%d ",ans[i]);
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=a;i<=n;++i)
#define lpd(i,a,n) for(int i=a;i>=n;--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 200002;
int n,q,m,a[N];
struct str {int t,l,r;} Q[N];

int solve(int i, int j){
    if(!j) return a[i];
    int l = Q[j].l, r = Q[j].r;
    if(i < l or i > r) return solve(i, j-1);
    if(Q[j].t == 1){
        if(i == l) i = r;
        else --i;
    }
    else{
        if(i-l < r-i) i = r - (i-l);
        else i = l + (r-i);
    }
    return solve(i, j-1);
}

int main(){
    read3i(n,q,m);
    lp(i,1,n) readi(a[i]);
    lp(i,1,q) read3i(Q[i].t, Q[i].l, Q[i].r);
    lp(i,1,m){
        int x;
        readi(x);
        printf("%d ", a[solve(x,q)]);
    }
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=a;i<=n;++i)
#define lpd(i,a,n) for(int i=a;i>=n;--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 200002;
int n,q,m,a[N],x[N],rem,ans[N];
struct str {int t,l,r;} Q[N];
vvi g(N);

int solve(int i, int j){
    if(j == q+1) return i;
    int l = Q[j].l, r = Q[j].r;
    if(i < l or i > r) return solve(i, j+1);

    if(Q[j].t == 1){
        if(i == r) i = l;
        else ++i;
    }
    else{
        if(i-l < r-i) i = r - (i-l);
        else i = l + (r-i);
    }
    return solve(i, j+1);
}

int main(){
    read3i(n,q,m);
    lp(i,1,n) readi(a[i]);
    lp(i,1,q) read3i(Q[i].t, Q[i].l, Q[i].r);
    lp(i,1,m) readi(x[i]), g[x[i]].pb(i);

    vi r;
    lp(i,1,n) r.pb(i);
    random_shuffle(all(r));

    rem = m;
    for(int i : r){
        int j = solve(i,1);
        if(sz(g[j])){
            for(int k : g[j]) ans[k] = a[i];
            rem -= sz(g[j]);
        }
        if(!rem) break;
    }

    lp(i,1,m) printf("%d ",ans[i]);
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define pw(x) (1ll<<(x))
#define inf 20000000000000005
#define MOD 1000000007
#define N 200005
#define M 100005
#define LOG 20
#define KOK 5880
#define EPS 0.0000001
using namespace std;

struct item {

	int key,pri;
	int l,r;
	int sub;
	bool rev;

} T[N];

int n,q,m,tot,root;

int rnd() {

	return rand()<<16^rand();

}

void up(int node) {

	swap(T[node].l,T[node].r);

	T[node].rev^=1;

}

void push(int node) {

	if(T[node].rev) {

		up(T[node].l);
		up(T[node].r);

		T[node].rev=0;

	}

}

void relax(int node) {

	T[node].sub=T[T[node].l].sub+T[T[node].r].sub+1;

}

void merge(int& root,int l,int r) {

	push(l);push(r);

	if(!l || !r) root=l?l:r;
	else if(T[l].pri>T[r].pri) merge(T[l].r,T[l].r,r),root=l;
	else merge(T[r].l,l,T[r].l),root=r;

	if(root) relax(root);

}

void split(int root,int lval,int& l,int& r) {

	push(root);

	if(!root) l=r=0;
	else if(T[T[root].l].sub+1<=lval) split(T[root].r,lval-T[T[root].l].sub-1,T[root].r,r),l=root;
	else split(T[root].l,lval,l,T[root].l),r=root;

	if(root) relax(root);

}

int get(int root,int pos) {

	push(root);

	if(pos==T[T[root].l].sub+1) return T[root].key;
	else if(pos<T[T[root].l].sub+1) return get(T[root].l,pos);

	return get(T[root].r,pos-T[T[root].l].sub-1);

}

int erase(int& root,int pos) {

	int ret;

	push(root);

	if(T[T[root].l].sub+1==pos) ret=root,merge(root,T[root].l,T[root].r);
	else if(T[T[root].l].sub+1>pos) ret=erase(T[root].l,pos);
	else ret=erase(T[root].r,pos-T[T[root].l].sub-1);

	if(root) relax(root);

	return ret;

}

void insert(int& root,int node,int pos) {

	push(root);

	if(!root) root=node;
	else if(T[root].pri>T[node].pri) {

		if(pos>T[T[root].l].sub+1) insert(T[root].r,node,pos-T[T[root].l].sub-1);
		else insert(T[root].l,node,pos);

	}
	else split(root,pos-1,T[node].l,T[node].r),root=node;

	if(root) relax(root);

}

int main(int argc,char* argv[]) {

	srand(time(NULL));

	T[0].sub=T[0].rev=0;

	scanf("%d %d %d",&n,&q,&m);

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

		int x;

		scanf("%d",&x);

		T[++tot]={x,rnd(),0,0,1,0};

		insert(root,tot,i+1);

	}

	while(q--) {

		int t,x,y;
		int t1,t2,t3;

		scanf("%d %d %d",&t,&x,&y);

		if(t==1) {

			split(root,y,t2,t3);
			split(t2,x-1,t1,t2);

			int t4=erase(t2,T[t2].sub);

			insert(t2,t4,1);

			merge(root,t1,t2);
			merge(root,root,t3);

		}
		else {

			split(root,y,t2,t3);
			split(t2,x-1,t1,t2);

			up(t2);

			merge(root,t1,t2);
			merge(root,root,t3);

		}

	}

	while(m--) {

		int x;

		scanf("%d",&x);

		printf("%d ",get(root,x));

	}

}


#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define pw(x) (1ll<<(x))
#define inf 20000000000000005
#define MOD 1000000007
#define N 200005
#define M 100005
#define LOG 20
#define KOK 5880
#define EPS 0.0000001
using namespace std;

struct item {

	int key,pri;
	int l,r;
	int sub;
	bool rev;

} T[N];

int n,q,m,tot,root;

int rnd() {

	return rand()<<16^rand();

}

void up(int node) {

	swap(T[node].l,T[node].r);

	T[node].rev^=1;

}

void push(int node) {

	if(T[node].rev) {

		up(T[node].l);
		up(T[node].r);

		T[node].rev=0;

	}

}

void relax(int node) {

	T[node].sub=T[T[node].l].sub+T[T[node].r].sub+1;

}

void merge(int& root,int l,int r) {

	push(l);push(r);

	if(!l || !r) root=l?l:r;
	else if(T[l].pri>T[r].pri) merge(T[l].r,T[l].r,r),root=l;
	else merge(T[r].l,l,T[r].l),root=r;

	if(root) relax(root);

}

void split(int root,int lval,int& l,int& r) {

	push(root);

	if(!root) l=r=0;
	else if(T[T[root].l].sub+1<=lval) split(T[root].r,lval-T[T[root].l].sub-1,T[root].r,r),l=root;
	else split(T[root].l,lval,l,T[root].l),r=root;

	if(root) relax(root);

}

int get(int root,int pos) {

	push(root);

	if(pos==T[T[root].l].sub+1) return T[root].key;
	else if(pos<T[T[root].l].sub+1) return get(T[root].l,pos);

	return get(T[root].r,pos-T[T[root].l].sub-1);

}

void insert(int& root,int node,int pos) {

	push(root);

	if(!root) root=node;
	else if(T[root].pri>T[node].pri) {

		if(pos>T[T[root].l].sub+1) insert(T[root].r,node,pos-T[T[root].l].sub-1);
		else insert(T[root].l,node,pos);

	}
	else split(root,pos-1,T[node].l,T[node].r),root=node;

	if(root) relax(root);

}

int main(int argc,char* argv[]) {

	srand(time(NULL));

	T[0].sub=T[0].rev=0;

	scanf("%d %d %d",&n,&q,&m);

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

		int x;

		scanf("%d",&x);

		T[++tot]={x,rnd(),0,0,1,0};

		insert(root,tot,i+1);

	}

	while(q--) {

		int t,x,y;
		int t1,t2,t3;

		scanf("%d %d %d",&t,&x,&y);

		if(t==1) {

			split(root,y,t2,t3);
			split(t2,x-1,t1,t2);

			int t4;

			split(t2,T[t2].sub-1,t2,t4);

			merge(t2,t4,t2);
			merge(root,t1,t2);
			merge(root,root,t3);

		}
		else {

			split(root,y,t2,t3);
			split(t2,x-1,t1,t2);

			up(t2);

			merge(root,t1,t2);
			merge(root,root,t3);

		}

	}

	while(m--) {

		int x;

		scanf("%d",&x);

		printf("%d ",get(root,x));

	}

}


#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define pw(x) (1ll<<(x))
#define inf 20000000000000005
#define MOD 1000000007
#define N 200005
#define M 100005
#define LOG 20
#define KOK 5880
#define EPS 0.0000001
using namespace std;

struct item {

	int key,pri;
	int l,r;
	int sub;
	bool rev;

} T[N];

int n,q,m,tot,root;

int rnd() {

	return rand()<<16^rand();

}

void up(int node) {

	swap(T[node].l,T[node].r);

	T[node].rev^=1;

}

void push(int node) {

	if(T[node].rev) {

		up(T[node].l);
		up(T[node].r);

		T[node].rev=0;

	}

}

void relax(int node) {

	T[node].sub=T[T[node].l].sub+T[T[node].r].sub+1;

}

void merge(int& root,int l,int r) {

	push(l);push(r);

	if(!l || !r) root=l?l:r;
	else if(T[l].pri>T[r].pri) merge(T[l].r,T[l].r,r),root=l;
	else merge(T[r].l,l,T[r].l),root=r;

	if(root) relax(root);

}

void split(int root,int lval,int& l,int& r) {

	push(root);

	if(!root) l=r=0;
	else if(T[T[root].l].sub+1<=lval) split(T[root].r,lval-T[T[root].l].sub-1,T[root].r,r),l=root;
	else split(T[root].l,lval,l,T[root].l),r=root;

	if(root) relax(root);

}

int get(int root,int pos) {

	push(root);

	if(pos==T[T[root].l].sub+1) return T[root].key;
	else if(pos<T[T[root].l].sub+1) return get(T[root].l,pos);

	return get(T[root].r,pos-T[T[root].l].sub-1);

}

int main(int argc,char* argv[]) {

	srand(time(NULL));

	T[0].sub=T[0].rev=0;

	scanf("%d %d %d",&n,&q,&m);

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

		int x;

		scanf("%d",&x);

		T[++tot]={x,rnd(),0,0,1,0};

		merge(root,root,tot);

	}

	while(q--) {

		int t,x,y;
		int t1,t2,t3;

		scanf("%d %d %d",&t,&x,&y);

		if(t==1) {

			split(root,y,t2,t3);
			split(t2,x-1,t1,t2);

			int t4;

			split(t2,T[t2].sub-1,t2,t4);

			merge(t2,t4,t2);
			merge(root,t1,t2);
			merge(root,root,t3);

		}
		else {

			split(root,y,t2,t3);
			split(t2,x-1,t1,t2);

			up(t2);

			merge(root,t1,t2);
			merge(root,root,t3);

		}

	}

	while(m--) {

		int x;

		scanf("%d",&x);

		printf("%d ",get(root,x));

	}

}


#include <bits/stdc++.h>
using namespace std;

#if DEBUG && !ONLINE_JUDGE
    #include "header.h"
#else
    #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
    return;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(20);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    preprocess();
    int n, q, m; cin>>n>>q>>m;
    vi a(n+1);
    rep(i,1,n+1) cin>>a[i];
    vector<pair<int, ii>> query;
    rep(i,0,q) {
      int t, l, r; cin>>t>>l>>r;
      query.pb({t, {l, r}});
    }
    vi b(m);
    rep(i,0,m) cin>>b[i];
    rep(i,0,m) {
      for(int j = q-1; j>=0; j--) {
        int l = query[j].se.fi, r = query[j].se.se;
        if(l <= b[i] && b[i] <= r) {
          if(query[j].fi == 1) {
            b[i] = (b[i] == l)?r:(b[i]-1);
          }
          else {
            b[i] = r-(b[i]-l);
          }
        }
      }
      cout<<a[b[i]]<<" ";
    }
}


#include <bits/stdc++.h>
using namespace std;

#if DEBUG && !ONLINE_JUDGE
  #include "header.h"
#else
  #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007

mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());

class node {
  public:
  int id;
  node* l;
  node* r;
  node* p;
  bool rev;
  int sz;
  // declare extra variables:
  int P;

  node(int _id) {
    id = _id;
    l = r = p = NULL;
    rev = false;
    sz = 1;
    // init extra variables:
    P = rng();
  }

  void unsafe_reverse() {
    rev ^= 1;
    swap(l, r);
    pull();
  }

  // apply changes:
  void unsafe_apply() {

  }

  void push() {
    if (rev) {
      if (l != NULL) {
        l->unsafe_reverse();
      }
      if (r != NULL) {
        r->unsafe_reverse();
      }
      rev = 0;
    }
    // now push everything else:

  }

  void pull() {
    sz = 1;
    // now init from self:

    if (l != NULL) {
      l->p = this;
      sz += l->sz;
      // now pull from l:

    }
    if (r != NULL) {
      r->p = this;
      sz += r->sz;
      // now pull from r:

    }
  }
};

void debug_node(node* v, string pref = "") {
  #ifdef LOCAL
    if (v != NULL) {
      debug_node(v->r, pref + " ");
      cerr << pref << "-" << " " << v->id << '\n';
      debug_node(v->l, pref + " ");
    } else {
      cerr << pref << "-" << " " << "NULL" << '\n';
    }
  #endif
}

namespace treap {
  pair<node*,int> find(node* v, const function<int(node*)> &go_to) {
    // go_to returns: 0 -- found; -1 -- go left; 1 -- go right
    // find returns the last vertex on the descent and its go_to
    if (v == NULL) {
      return {NULL, 0};
    }
    int dir;
    while (true) {
      v->push();
      dir = go_to(v);
      if (dir == 0) {
        break;
      }
      node* u = (dir == -1 ? v->l : v->r);
      if (u == NULL) {
        break;
      }
      v = u;
    }
    return {v, dir};
  }

  node* get_leftmost(node* v) {
    return find(v, [&](node*) { return -1; }).first;
  }

  node* get_rightmost(node* v) {
    return find(v, [&](node*) { return 1; }).first;
  }

  node* get_kth(node* v, int k) { // 0-indexed
    pair<node*,int> p = find(v, [&](node* u) {
      if (u->l != NULL) {
        if (u->l->sz > k) {
          return -1;
        }
        k -= u->l->sz;
      }
      if (k == 0) {
        return 0;
      }
      k--;
      return 1;
    });
    return (p.second == 0 ? p.first : NULL);
  }

  int get_position(node* v) { // 0-indexed
    int k = (v->l != NULL ? v->l->sz : 0);
    while (v->p != NULL) {
      if (v == v->p->r) {
        k++;
        if (v->p->l != NULL) {
          k += v->p->l->sz;
        }
      }
      v = v->p;
    }
    return k;
  }

  node* get_bst_root(node* v) {
    while (v->p != NULL) {
      v = v->p;
    }
    return v;
  }

  pair<node*,node*> split(node* v, const function<bool(node*)> &is_right) {
    if (v == NULL) {
      return {NULL, NULL};
    }
    v->push();
    if (is_right(v)) {
      pair<node*,node*> p = split(v->l, is_right);
      if (p.first != NULL) {
        p.first->p = NULL;
      }
      v->l = p.second;
      v->pull();
      return {p.first, v};
    } else {
      pair<node*,node*> p = split(v->r, is_right);
      v->r = p.first;
      if (p.second != NULL) {
        p.second->p = NULL;
      }
      v->pull();
      return {v, p.second};
    }
  }

  pair<node*,node*> split_leftmost_k(node* v, int k) {
    return split(v, [&](node* u) {
      int left_and_me = (u->l != NULL ? u->l->sz : 0) + 1;
      if (k >= left_and_me) {
        k -= left_and_me;
        return false;
      }
      return true;
    });
  }

  node* merge(node* v, node* u) {
    if (v == NULL) {
      return u;
    }
    if (u == NULL) {
      return v;
    }
    if (v->P > u->P) {
//    if (rng() % (v->sz + u->sz) < (unsigned int) v->sz) {
      v->push();
      v->r = merge(v->r, u);
      v->pull();
      return v;
    } else {
      u->push();
      u->l = merge(v, u->l);
      u->pull();
      return u;
    }
  }

  node* add(node* r, node* v, const function<bool(node*)> &go_left) {
    pair<node*,node*> p = split(r, go_left);
    return merge(p.first, merge(v, p.second));
  }

  node* remove(node* v) { // returns the new root
    v->push();
    node* x = v->l;
    node* y = v->r;
    node* p = v->p;
    v->l = v->r = v->p = NULL;
    v->push();
    v->pull(); // now v might be reusable...
    node* z = merge(x, y);
    if (p == NULL) {
      if (z != NULL) {
        z->p = NULL;
      }
      return z;
    }
    if (p->l == v) {
      p->l = z;
    }
    if (p->r == v) {
      p->r = z;
    }
    while (true) {
      p->push();
      p->pull();
      if (p->p == NULL) {
        break;
      }
      p = p->p;
    }
    return p;
  }

  node* next(node* v) {
    if (v->r == NULL) {
      while (v->p != NULL && v->p->r == v) {
        v = v->p;
      }
      return v->p;
    }
    v->push();
    v = v->r;
    while (v->l != NULL) {
      v->push();
      v = v->l;
    }
    return v;
  }

  node* prev(node* v) {
    if (v->l == NULL) {
      while (v->p != NULL && v->p->l == v) {
        v = v->p;
      }
      return v->p;
    }
    v->push();
    v = v->l;
    while (v->r != NULL) {
      v->push();
      v = v->r;
    }
    return v;
  }

  int get_size(node* v) {
    return (v != NULL ? v->sz : 0);
  }

  template<typename... T>
  void apply(node* v, T... args) {
    v->unsafe_apply(args...);
  }

  void reverse(node* v) {
    v->unsafe_reverse();
  }
}

using namespace treap;

void preprocess(void) {
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  preprocess();
  int n, q, m; cin>>n>>q>>m;
  vi a(n);
  node *root = NULL;
  rep(i,0,n) cin>>a[i];
  rep(i,0,n) root = merge(root, new node(a[i]));
  while(q--) {
    int t, l, r; cin>>t>>l>>r;
    l--; r--;
    if(t == 1) {
      pair<node*, node*> s = split_leftmost_k(root, l);
      pair<node*, node*> g = split_leftmost_k(s.se, r-l);
      pair<node*, node*> f = split_leftmost_k(g.se, 1);
      root = merge(s.fi, merge(f.fi, merge(g.fi, f.se)));
    }
    else {
      pair<node*, node*> s = split_leftmost_k(root, l);
      pair<node*, node*> g = split_leftmost_k(s.se, r-l+1);
      reverse(g.first);
      root = merge(s.fi, merge(g.first, g.second));
    }
  }
  rep(i,0,m) {
    int x; cin>>x;
    x--;
    cout<<get_kth(root, x)->id<<" ";
  }
}


#include <bits/stdc++.h>
using namespace std;

#if DEBUG && !ONLINE_JUDGE
  #include "header.h"
#else
  #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007

class node {
  public:
  int id;
  node* l;
  node* r;
  node* p;
  bool rev;
  int sz;
  // declare extra variables:

  node(int _id) {
    id = _id;
    l = r = p = NULL;
    rev = false;
    sz = 1;
    // init extra variables:

  }

  void unsafe_reverse() {
    rev ^= 1;
    swap(l, r);
    pull();
  }

  // apply changes:
  void unsafe_apply() {

  }

  void push() {
    if (rev) {
      if (l != NULL) {
        l->unsafe_reverse();
      }
      if (r != NULL) {
        r->unsafe_reverse();
      }
      rev = 0;
    }
    // now push everything else:

  }

  void pull() {
    sz = 1;
    // now init from self:

    if (l != NULL) {
      l->p = this;
      sz += l->sz;
      // now pull from l:

    }
    if (r != NULL) {
      r->p = this;
      sz += r->sz;
      // now pull from r:

    }
  }
};

void debug_node(node* v, string pref = "") {
  #ifdef LOCAL
    if (v != NULL) {
      debug_node(v->r, pref + " ");
      cerr << pref << "-" << " " << v->id << " " << v->sz << " " << v->rev << " " << v << " " << v->p << '\n';
      debug_node(v->l, pref + " ");
    } else {
      cerr << pref << "-" << " " << "NULL" << '\n';
    }
  #endif
}

namespace splay_tree {
  bool is_bst_root(node* v) {
    if (v == NULL) {
      return false;
    }
    return (v->p == NULL || (v->p->l != v && v->p->r != v));
  }

  void rotate(node* v) {
    node* u = v->p;
    assert(u != NULL);
    u->push();
    v->push();
    v->p = u->p;
    if (v->p != NULL) {
      if (v->p->l == u) {
        v->p->l = v;
      }
      if (v->p->r == u) {
        v->p->r = v;
      }
    }
    if (v == u->l) {
      u->l = v->r;
      v->r = u;
    } else {
      u->r = v->l;
      v->l = u;
    }
    u->pull();
    v->pull();
  }

  void splay(node* v) {
    if (v == NULL) {
      return;
    }
    while (!is_bst_root(v)) {
      node* u = v->p;
      if (!is_bst_root(u)) {
        if ((u->l == v) ^ (u->p->l == u)) {
          rotate(v);
        } else {
          rotate(u);
        }
      }
      rotate(v);
    }
  }

  pair<node*,int> find(node* v, const function<int(node*)> &go_to) {
    // go_to returns: 0 -- found; -1 -- go left; 1 -- go right
    // find returns the last vertex on the descent and its go_to
    if (v == NULL) {
      return {NULL, 0};
    }
    splay(v);
    int dir;
    while (true) {
      v->push();
      dir = go_to(v);
      if (dir == 0) {
        break;
      }
      node* u = (dir == -1 ? v->l : v->r);
      if (u == NULL) {
        break;
      }
      v = u;
    }
    splay(v);
    return {v, dir};
  }

  node* get_leftmost(node* v) {
    return find(v, [&](node*) { return -1; }).first;
  }

  node* get_rightmost(node* v) {
    return find(v, [&](node*) { return 1; }).first;
  }

  node* get_kth(node* v, int k) { // 0-indexed
    pair<node*,int> p = find(v, [&](node* u) {
      if (u->l != NULL) {
        if (u->l->sz > k) {
          return -1;
        }
        k -= u->l->sz;
      }
      if (k == 0) {
        return 0;
      }
      k--;
      return 1;
    });
    return (p.second == 0 ? p.first : NULL);
  }

  int get_position(node* v) { // 0-indexed
    splay(v);
    return (v->l != NULL ? v->l->sz : 0);
  }

  node* get_bst_root(node* v) {
    splay(v);
    return v;
  }

  pair<node*,node*> split(node* v, const function<bool(node*)> &is_right) {
    if (v == NULL) {
      return {NULL, NULL};
    }
    pair<node*,int> p = find(v, [&](node* u) { return is_right(u) ? -1 : 1; });
    v = p.first;
    v->push();
    if (p.second == -1) {
      node* u = v->l;
      if (u == NULL) {
        return {NULL, v};
      }
      v->l = NULL;
      u->p = v->p;
      u = get_rightmost(u);
      v->p = u;
      v->pull();
      return {u, v};
    } else {
      node* u = v->r;
      if (u == NULL) {
        return {v, NULL};
      }
      v->r = NULL;
      v->pull();
      return {v, u};
    }
  }

  pair<node*,node*> split_leftmost_k(node* v, int k) {
    return split(v, [&](node* u) {
      int left_and_me = (u->l != NULL ? u->l->sz : 0) + 1;
      if (k >= left_and_me) {
        k -= left_and_me;
        return false;
      }
      return true;
    });
  }

  node* merge(node* v, node* u) {
    if (v == NULL) {
      return u;
    }
    if (u == NULL) {
      return v;
    }
    v = get_rightmost(v);
    assert(v->r == NULL);
    splay(u);
    v->push();
    v->r = u;
    v->pull();
    return v;
  }

  node* add(node* r, node* v, const function<bool(node*)> &go_left) {
    pair<node*,node*> p = split(r, go_left);
    return merge(p.first, merge(v, p.second));
  }

  node* remove(node* v) { // returns the new root
    splay(v);
    v->push();
    node* x = v->l;
    node* y = v->r;
    v->l = v->r = NULL;
    node* z = merge(x, y);
    if (z != NULL) {
      z->p = v->p;
    }
    v->p = NULL;
    v->push();
    v->pull(); // now v might be reusable...
    return z;
  }

  node* next(node* v) {
    splay(v);
    v->push();
    if (v->r == NULL) {
      return NULL;
    }
    v = v->r;
    while (v->l != NULL) {
      v->push();
      v = v->l;
    }
    splay(v);
    return v;
  }

  node* prev(node* v) {
    splay(v);
    v->push();
    if (v->l == NULL) {
      return NULL;
    }
    v = v->l;
    while (v->r != NULL) {
      v->push();
      v = v->r;
    }
    splay(v);
    return v;
  }

  int get_size(node* v) {
    splay(v);
    return (v != NULL ? v->sz : 0);
  }

  template<typename... T>
  void apply(node* v, T... args) {
    splay(v);
    v->unsafe_apply(args...);
  }

  void reverse(node* v) {
    splay(v);
    v->unsafe_reverse();
  }
}

using namespace splay_tree;

void preprocess(void) {
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  preprocess();
  int n, q, m; cin>>n>>q>>m;
  vi a(n);
  node *root = NULL;
  rep(i,0,n) cin>>a[i];
  rep(i,0,n) root = merge(root, new node(a[i]));
  while(q--) {
    int t, l, r; cin>>t>>l>>r;
    l--; r--;
    if(t == 1) {
      pair<node*, node*> s = split_leftmost_k(root, l);
      pair<node*, node*> g = split_leftmost_k(s.se, r-l);
      pair<node*, node*> f = split_leftmost_k(g.se, 1);
      root = merge(s.fi, merge(f.fi, merge(g.fi, f.se)));
    }
    else {
      pair<node*, node*> s = split_leftmost_k(root, l);
      pair<node*, node*> g = split_leftmost_k(s.se, r-l+1);
      reverse(g.first);
      root = merge(s.fi, merge(g.first, g.second));
    }
  }
  rep(i,0,m) {
    int x; cin>>x;
    x--;
    cout<<get_kth(root, x)->id<<" ";
  }

}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a[200005],b;
int t[110],l[110],r[110];
int main()
{
    int n,q,m;
    cin>>n>>q>>m;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=q;i>=1;i--)
        scanf("%d%d%d",&t[i],&l[i],&r[i]);
    for(int i=1;i<=m;i++)
    {
        scanf("%d",&b);
        for(int j=1;j<=q;j++)
        {
            if(b>=l[j]&&b<=r[j])
            {
                if(t[j]==1)
                {
                    b--;
                    if(b<l[j])
                        b=r[j];
                }
                else
                    b=r[j]-(b-l[j]);
            }
        }
            cout<<a[b]<<" ";
    }
    cout<<endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a[200005],b;
int t[110],l[110],r[110];
int main()
{
    int n,q,m;
    cin>>n>>q>>m;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=q;i++)
        scanf("%d%d%d",&t[i],&l[i],&r[i]);
    for(int i=1;i<=m;i++)
    {
        scanf("%d",&b);
        for(int j=q;j>=1;j--)
        {
            if(b>=l[j]&&b<=r[j])
            {
                if(t[j]==1)
                {
                    b--;
                    if(b<l[j])
                        b=r[j];
                }
                else
                    b=r[j]-(b-l[j]);
            }
        }
        if(i==1)
            cout<<a[b];
        else
            cout<<" "<<a[b];
    }
    cout<<endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a[200005],b[200005];
int t[200005],l[200005],r[200005];
int main()
{
    int n,q,m;
    cin>>n>>q>>m;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=q;i++)
    {
        scanf("%d%d%d",&t[i],&l[i],&r[i]);
        if(t[i]==1)
        {
            int tt=a[r[i]];
            for(int j=r[i];j>=l[i]+1;j--)
            {
                a[j]=a[j-1];
            }
            a[l[i]]=tt;
        }
        else
        {
            for(int j=l[i];j<=(l[i]+r[i])/2;j++)
            {
                int tt=a[j];
                a[j]=a[r[i]-(j-l[i])];
                a[r[i]-(j-l[i])]=tt;
            }
        }
    }
    for(int i=1;i<=m;i++)
    {
        scanf("%d",&b[i]);
        if(i==1)
            cout<<a[b[i]];
        else
            cout<<" "<<a[b[i]];
    }
    cout<<endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a[200005],b;
int t[110],l[110],r[110];
int main()
{
    int n,q,m;
    cin>>n>>q>>m;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=q;i>=1;i--)
        scanf("%d%d%d",&t[i],&l[i],&r[i]);
    for(int i=1;i<=m;i++)
    {
        scanf("%d",&b);
        for(int j=1;j<=q;j++)
        {
            if(b>=l[j]&&b<=r[j])
            {
                if(t[j]==1)
                {
                    b--;
                    if(b<l[j])
                        b=r[j];
                }
                else
                    b=r[j]-(b-l[j]);
            }
        }
        if(i==1)
            cout<<a[b];
        else
            cout<<" "<<a[b];
    }
    cout<<endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a[200005],b[200005];
int t[110],l[110],r[110];
int main()
{
    int n,q,m;
    cin>>n>>q>>m;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=q;i++)
    {
        scanf("%d%d%d",&t[i],&l[i],&r[i]);
        if(t[i]==1)
        {
            int tt=a[r[i]];
            for(int j=r[i];j>=l[i]+1;j--)
            {
                a[j]=a[j-1];
            }
            a[l[i]]=tt;
        }
        else
        {
            for(int j=l[i];j<=(l[i]+r[i])/2;j++)
            {
                int tt=a[j];
                a[j]=a[r[i]-(j-l[i])];
                a[r[i]-(j-l[i])]=tt;
            }
        }
    }
    for(int i=1;i<=m;i++)
    {
        scanf("%d",&b[i]);
        if(i==1)
            cout<<a[b[i]];
        else
            cout<<" "<<a[b[i]];
    }
    cout<<endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a[200005],b;
int t[200005],l[200005],r[200005];
int main()
{
    int n,q,m;
    cin>>n>>q>>m;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=q;i++)
        scanf("%d%d%d",&t[i],&l[i],&r[i]);
    for(int i=1;i<=m;i++)
    {
        scanf("%d",&b);
        for(int j=q;j>=1;j--)
        {
            if(b>=l[j]&&b<=r[j])
            {
                if(t[j]==1)
                {
                    b--;
                    if(b<l[j])
                        b=r[j];
                }
                else
                    b=r[j]-(b-l[j]);
            }
        }
        if(i==1)
            cout<<a[b];
        else
            cout<<" "<<a[b];
    }
    cout<<endl;
    return 0;
}


/*
Solves CF 863D
Given an array
2 types of updates
    1. Reverse a segment
    2. Cyclically shift a segment to the right
*/

#include<bits/stdc++.h>
using namespace std;
typedef struct item * pitem;
struct item {
	int prior, value, cnt; bool rev;
	item(int value):prior(rand()), value(value) {
		cnt = 0; rev = 0; l = r = nullptr;
	}
	pitem l, r;
}; ///use 0-based indexing
namespace Treap {
	int cnt (pitem it) {
		return it != nullptr? it->cnt : 0;
	}
	void upd_cnt (pitem it) {
		if (it != nullptr)
			it->cnt = cnt(it->l)+cnt(it->r)+1;
	}
	void push (pitem it) {
		if (it != nullptr && it->rev == true) {
			it->rev = false; swap (it->l, it->r);
			if (it->l)  it->l->rev ^= true;
			if (it->r)  it->r->rev ^= true;
		}
	}
	void merge (pitem & t, pitem l, pitem r) {
		push (l); push (r);
		if (l==nullptr || r==nullptr)
			t = (l!=nullptr) ? l : r;
		else if (l->prior > r->prior)
			merge (l->r, l->r, r),  t = l;
		else
			merge (r->l, l, r->l),  t = r;
		upd_cnt (t);
	}
	void split (pitem t, pitem &l, pitem &r,
							int key, int add = 0) {
		if (t==nullptr) {
			l = r = nullptr;  return;
		}
		push (t);  int cur_key = add + cnt(t->l);
		if (key <= cur_key)
			split (t->l, l, t->l, key, add),  r = t;
		else
			split (t->r,t->r,r,key,add+1+cnt(t->l)), l=t;
		upd_cnt (t);
	}
	void reverse (pitem &t, int l, int r) {
		pitem t1, t2, t3;		split (t, t1, t2, l);
		split (t2, t2, t3, r-l+1);	t2->rev ^= true;
		merge (t, t1, t2);	merge (t, t, t3);
	}
	void insert (pitem & t, int key, int value) {
		pitem x = new item(value);
		pitem L, R;				split(t, L, R, key);
		merge(L, L, x);		merge(t, L, R);		upd_cnt(t);
	}
	void erase (pitem & t, int key) {
		assert(cnt(t) > key); 	pitem L, MID, R;
		split(t, L, MID, key);	split(MID, MID, R, 1);
		merge(t, L, R);		delete MID;		upd_cnt(t);
	}
	void cyclicShift(pitem &t, int l, int r) {
		assert(0 <= l && r < cnt(t));
		pitem L, MID, R;	split(t, L, MID, r);
		split(MID, MID, R, 1);	merge(t, L, R);
		assert(MID!=nullptr);	insert(t, l, MID->value);
		delete MID;	upd_cnt(t);
	}
	void output (pitem t, vector< int >&v) {
		if (t==nullptr) return;
		push (t); 							output(t->l,v);
		v.push_back(t->value); 	output(t->r,v);
	}
}
int main() {
	ios::sync_with_stdio(false);
	srand(time(0));
	pitem tr = nullptr;
	int n, q, m;
	cin >> n >> q >> m;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		Treap::insert(tr, i, x);
	}
	while (q--) {
		int t, l, r;
		cin >> t >> l >> r;
		l--; r--;
		if (l==r) continue;
		if (t==1) Treap::cyclicShift(tr, l, r);
		else Treap::reverse(tr, l, r);
	}
	vector< int >b;
	Treap::output(tr, b);
	while (m--) {
		int x;
		cin >> x; x--;
		cout << b[x] << " ";
	}
	return 0;
}


/*
Solves CF 863D
Given an array
2 types of updates
    1. Reverse a segment
    2. Cyclically shift a segment to the right
*/

#include<bits/stdc++.h>
using namespace std;

typedef struct item * pitem;
struct item {
    int prior, value, cnt;
    bool rev;

    item(int value):prior(rand()), value(value) {
        cnt = 0;
        rev = 0;
        l = r = nullptr;
    }

    pitem l, r;
};

namespace Treap {

    int cnt (pitem it) {
        return it != nullptr? it->cnt : 0;
    }

    void upd_cnt (pitem it) {
        if (it!=nullptr)
            it->cnt = cnt(it->l) + cnt(it->r) + 1;
    }

    void push (pitem it) {
        if (it != nullptr && it->rev == true) {
            it->rev = false;
            swap (it->l, it->r);
            if (it->l)  it->l->rev ^= true;
            if (it->r)  it->r->rev ^= true;
        }
    }

    void merge (pitem & t, pitem l, pitem r) {
        push (l);
        push (r);
        if (l==nullptr || r==nullptr)
            t = (l!=nullptr) ? l : r;
        else if (l->prior > r->prior)
            merge (l->r, l->r, r),  t = l;
        else
            merge (r->l, l, r->l),  t = r;
        upd_cnt (t);
    }

    void split (pitem t, pitem & l, pitem & r, int key, int add = 0) {
        if (t==nullptr) {
            l = r = nullptr;
            return;
        }
        push (t);
        int cur_key = add + cnt(t->l);

        if (key <= cur_key)
            split (t->l, l, t->l, key, add),  r = t;
        else
            split (t->r, t->r, r, key, add + 1 + cnt(t->l)),  l = t;
        upd_cnt (t);
    }

    void reverse (pitem &t, int l, int r) {
        pitem t1, t2, t3;
        split (t, t1, t2, l);
        split (t2, t2, t3, r-l+1);
        t2->rev ^= true;
        merge (t, t1, t2);
        merge (t, t, t3);
    }

    void insert (pitem & t, int key, int value) {

        pitem x = new item(value);

        pitem L, R;
        split(t, L, R, key);
        merge(L, L, x);
        merge(t, L, R);

        upd_cnt(t);
    }

    void erase (pitem & t, int key) {
        assert(cnt(t) > key);

        pitem L, MID, R;
        split(t, L, MID, key);
        split(MID, MID, R, 1);
        merge(t, L, R);

        delete MID;

        upd_cnt(t);
    }

    void cyclicShift(pitem &t, int l, int r)
    {
        assert(0 <= l && r < cnt(t));

        pitem L, MID, R;
        split(t, L, MID, r);
        split(MID, MID, R, 1);
        merge(t, L, R);

        assert(MID!=nullptr);
        insert(t, l, MID->value);
        delete MID;
        upd_cnt(t);
    }

    void output (pitem t, vector< int >&v) {
        if (t==nullptr)  return;
        push (t);
        output (t->l, v);
        v.push_back(t->value);
        output (t->r, v);
    }

    void output2 (pitem t) {
        if (t==nullptr)  return;
        push (t);
        cout << "(";
        output2 (t->l);
        cout << (t->value);
        output2 (t->r);
        cout << ")";
    }
}

int main()
{
    std::ios_base::sync_with_stdio(false);

    srand(time(0));

    pitem tr = nullptr;

    int n, q, m;
    cin >> n >> q >> m;

    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        Treap::insert(tr, i, x);
    }

    while (q--) {
        int t, l, r;
        cin >> t >> l >> r;
        l--; r--;
        if (l==r) continue;
        if (t==1) Treap::cyclicShift(tr, l, r);
        else Treap::reverse(tr, l, r);
    }

    vector< int >b;
    Treap::output(tr, b);

    while (m--) {
        int x;
        cin >> x; x--;
        cout << b[x] << " ";
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		pair<node*, node*> ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		pair<node*, node*> ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.push_back(t->val);
          p(t->r);
}

int n,m,l,r,q,b,a,t;
node* root;

int main()
{
          ios_base::sync_with_stdio(0);
          cin>>n>>q>>m;
          for(int i=0;i<n;i++)
          {
                    cin>>a;
                    root = merge(root, new node{a, rand(), 1, 0, 0, 0});
          }
          int pos=0;
          while(q--)
          {
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              pair<node*,node*> x = split(root, r);
			pair<node*,node*>  y = split(x.first, l - 1);
			pair<node*,node*>  z = split(y.second, r - l);
			root = merge(z.second, z.first);
			root = merge(y.first, root);
			root = merge(root, x.second);
                    }
                    else
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
          p(root);
          for(int i=0;i<m;i++)
          {
                    cin>>b;
                    cout<<ans[b-1]<<" ";
          }
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		pair<node*, node*> ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		pair<node*, node*> ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.push_back(t->val);
          p(t->r);
}

int n,m,l,r,q,b,a,t;
node* root;

int main()
{
          ios_base::sync_with_stdio(0);
          cin>>n>>q>>m;
          for(int i=0;i<n;i++)
          {
                    cin>>a;
                    root = merge(root, new node{a, rand(), 1, 0, 0, 0});
          }
          int pos=0;
          for(int i=0;i<q;i++)
          {
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              pair<node*, node*> z=split(y.second,r-1);
			root = merge(z.second, z.first);
			root = merge(y.first, root);
			root = merge(root, x.second);
                    }
                    else
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
          p(root);
          for(int i=0;i<m;i++)
          {
                    cin>>b;
                    cout<<ans[b-1]<<" ";
          }
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		pair<node*, node*> ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		pair<node*, node*> ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.push_back(t->val);
          p(t->r);
}

int n,m,l,r,q,b,a,t;
node* root;

int main()
{
          ios_base::sync_with_stdio(0);
          cin>>n>>q>>m;
          for(int i=0;i<n;i++)
          {
                    cin>>a;
                    root = merge(root, new node{a, rand(), 1, 0, 0, 0});
          }
          int pos=0;
          for(int i=0;i<q;i++)
          {
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              pair<node*, node*> z=split(y.second,r-1);
                              root=merge(y.first,z.second);
                              root=merge(root,z.first);
                              root=merge(root,x.second);
                    }
                    else
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
          p(root);
          for(int i=0;i<m;i++)
          {
                    cin>>b;
                    cout<<ans[b-1]<<" ";
          }
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		pair<node*, node*> ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		pair<node*, node*> ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.push_back(t->val);
          p(t->r);
}

int n,m,l,r,q,b,a,t;
node* root;

int main()
{
          ios_base::sync_with_stdio(0);
          cin>>n>>q>>m;
          for(int i=0;i<n;i++)
          {
                    cin>>a;
                    root = merge(root, new node{a, rand(), 1, 0, 0, 0});
          }
          int pos=0;
          for(int i=0;i<q;i++)
          {
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              pair<node*, node*> z=split(y.second,r-l);
                              root=merge(y.first,z.second);
                              root=merge(root,z.first);
                              root=merge(root,x.second);
                    }
                    else
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
          p(root);
          for(int i=0;i<m;i++)
          {
                    cin>>b;
                    cout<<ans[b-1]<<" ";
          }
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		pair<node*, node*> ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		pair<node*, node*> ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.emplace_back(t->val);
          p(t->r);
}

int n,m,l,r,q,b,a,t;

int main()
{
          ios_base::sync_with_stdio(0);
          cin>>n>>q>>m;
          node* root=0;
          mt19937 rng(time(0));
	uniform_int_distribution<int> dis;
          for(int i=0;i<n;i++)
          {
                    cin>>a;
                    root = merge(root, new node{a, dis(rng), 1, 0, 0, 0});
          }
          for(int i=0;i<q;i++)
          {
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              pair<node*, node*> z=split(y.second,r-1);
                              root=merge(y.first,z.second);
                              root=merge(root,z.first);
                              root=merge(root,x.second);
                    }
                    else
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
          p(root);
          for(int i=0;i<m;i++)
          {
                    cin>>b;
                    cout<<ans[b-1]<<" ";
          }
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		pair<node*, node*> ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		pair<node*, node*> ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.push_back(t->val);
          p(t->r);
}

int main()
{
          ios_base::sync_with_stdio(0);
          int n,q,m;
          cin>>n>>q>>m;
          node* root=0;
          for(int i=0;i<n;i++)
          {
                    int a;
                    cin>>a;
                    root = merge(root, new node{a, rand()*rand(), 1, 0, 0, 0});
          }
          for(int i=0;i<q;i++)
          {
                    int t,l,r;
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              pair<node*, node*> z=split(y.second,r-1);
                              root=merge(y.first,z.second);
                              root=merge(root,z.first);
                              root=merge(root,x.second);
                    }
                    else
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
          p(root);
          for(int i=0;i<m;i++)
          {
                    int b;
                    cin>>b;
                    cout<<ans[b-1]<<" ";
          }
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		pair<node*, node*> ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		pair<node*, node*> ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.push_back(t->val);
          p(t->r);
}

int n,m,l,r,q,b,a,t;

int main()
{
          ios_base::sync_with_stdio(0);
          cin>>n>>q>>m;
          node* root=0;
          mt19937 rng(time(0));
	uniform_int_distribution<int> dis;
          for(int i=0;i<n;i++)
          {
                    cin>>a;
                    root = merge(root, new node{a, dis(rng), 1, 0, 0, 0});
          }
          int pos=0;
          for(int i=0;i<q;i++)
          {
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              pair<node*, node*> z=split(y.second,r-1);
                              root=merge(y.first,z.second);
                              root=merge(root,z.first);
                              root=merge(root,x.second);
                    }
                    else
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
          p(root);
          for(int i=0;i<m;i++)
          {
                    cin>>b;
                    cout<<ans[b-1]<<" ";
          }
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		pair<node*, node*> ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		pair<node*, node*> ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.push_back(t->val);
          p(t->r);
}

int main()
{
          ios_base::sync_with_stdio(0);
          int n,q,m;
          cin>>n>>q>>m;
          node* root=0;
          for(int i=0;i<n;i++)
          {
                    int a;
                    cin>>a;
                    root = merge(root, new node{a, rand()*rand(), 1, 0, 0, 0});
          }
          for(int i=0;i<q;i++)
          {
                    int t,l,r;
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              pair<node*, node*> z=split(y.second,r-1);
                              root=merge(z.second,z.first);
                              root=merge(y.first,root);
                              root=merge(root,x.second);
                    }
                    else
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
	vector<int> ord;

	function<void(node*)> dfs = [&](node *u)
	{
		if (!u) return;
		push(u);
		dfs(u->l);
		ord.emplace_back(u->val);
		dfs(u->r);
	};

	dfs(root);

	for (int i = 0; i < m; ++i)
	{
		int b;
		cin >> b;
		cout << ord[--b] << " \n"[i+1==m];
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		pair<node*, node*> ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		pair<node*, node*> ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.push_back(t->val);
          p(t->r);
}

int n,m,l,r,q,b,a,t;
node* root;

int main()
{
          ios_base::sync_with_stdio(0);
          cin>>n>>q>>m;
          for(int i=0;i<n;i++)
          {
                    cin>>a;
                    root = merge(root, new node{a, rand()*rand(), 1, 0, 0, 0});
          }
          int pos=0;
          for(int i=0;i<q;i++)
          {
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              pair<node*, node*> z=split(y.second,r-1);
                              root=merge(y.first,z.second);
                              root=merge(root,z.first);
                              root=merge(root,x.second);
                    }
                    else
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
          p(root);
          for(int i=0;i<m;i++)
          {
                    cin>>b;
                    cout<<ans[b-1]<<" ";
          }
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		auto ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		auto ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.emplace_back(t->val);
          p(t->r);
}

int n,m,l,r,q,b,a,t;

int main()
{
          ios_base::sync_with_stdio(0);
          cin>>n>>q>>m;
          node* root=0;
          mt19937 rng(time(0));
	uniform_int_distribution<int> dis;
          for(int i=0;i<n;i++)
          {
                    cin>>a;
                    root = merge(root, new node{a, dis(rng), 1, 0, 0, 0});
          }
          for(int i=0;i<q;i++)
          {
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              auto x=split(root,r);
                              auto y=split(x.first,l-1);
                              auto z=split(y.second,r-1);
                              root=merge(y.first,z.second);
                              root=merge(root,z.first);
                              root=merge(root,x.second);
                    }
                    else
                    {
                              auto x=split(root,r);
                              auto y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
          p(root);
          for(int i=0;i<m;i++)
          {
                    cin>>b;
                    cout<<ans[b-1]<<" ";
          }
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		pair<node*, node*> ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		pair<node*, node*> ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.push_back(t->val);
          p(t->r);
}

int n,m,l,r,q,b,a,t;

int main()
{
          ios_base::sync_with_stdio(0);
          cin>>n>>q>>m;
          node* root=0;
          for(int i=0;i<n;i++)
          {
                    cin>>a;
                    root = merge(root, new node{a, rand()*rand(), 1, 0, 0, 0});
          }
          int pos=0;
          for(int i=0;i<q;i++)
          {
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              pair<node*, node*> z=split(y.second,r-1);
                              root=merge(y.first,z.second);
                              root=merge(root,z.first);
                              root=merge(root,x.second);
                    }
                    else
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
          p(root);
          for(int i=0;i<m;i++)
          {
                    cin>>b;
                    cout<<ans[b-1]<<" ";
          }
}


#include <bits/stdc++.h>

using namespace std;

struct node
{
	int val, prio, size, rev;
	node *l, *r;
};

inline int size(node *u) { return u ? u->size : 0; }

node* update(node *u)
{
	if (u) u->size = 1 + size(u->l) + size(u->r);
	return u;
}

void push(node *u)
{
	if (u && u->rev)
	{
		swap(u->l, u->r);
		if (u->l) u->l->rev ^= 1;
		if (u->r) u->r->rev ^= 1;
		u->rev = 0;
	}
}

node* merge(node *u, node *v)
{
	push(u); push(v);
	if (!u || !v) return u ? u : v;
	if (u->prio > v->prio)
	{
		u->r = merge(u->r, v);
		update(u);
		return u;
	}
	else
	{
		v->l = merge(u, v->l);
		update(v);
		return v;
	}
}

pair<node*, node*> split(node *u, int k)
{
	if (!u) return make_pair(u, u);
	push(u);
	if (size(u->l) >= k)
	{
		pair<node*, node*> ans = split(u->l, k);
		u->l = ans.second;
		update(u);
		ans.second = u;
		return ans;
	}
	else
	{
		pair<node*, node*> ans = split(u->r, k - size(u->l) - 1);
		u->r = ans.first;
		update(u);
		ans.first = u;
		return ans;
	}
}

vector<int> ans;

void p(node* t)
{
          if(!t) return;
          push(t);
          p(t->l);
          ans.push_back(t->val);
          p(t->r);
}

int n,m,l,r,q,b,a,t;
node* root;

int main()
{
          ios_base::sync_with_stdio(0);
          cin>>n>>q>>m;
          for(int i=0;i<n;i++)
          {
                    cin>>a;
                    root = merge(root, new node{a, rand(), 1, 0, 0, 0});
          }
          int pos=0;
          while(q--)
          {
                    cin>>t>>l>>r;
                    if(t==1)
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              pair<node*, node*> z=split(y.second,r-1);
			root = merge(z.second, z.first);
			root = merge(y.first, root);
			root = merge(root, x.second);
                    }
                    else
                    {
                              pair<node*, node*> x=split(root,r);
                              pair<node*, node*> y=split(x.first,l-1);
                              y.second->rev=1;
                              root=merge(y.first,y.second);
                              root=merge(root,x.second);
                    }
          }
          p(root);
          for(int i=0;i<m;i++)
          {
                    cin>>b;
                    cout<<ans[b-1]<<" ";
          }
}