#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define ms(a,b) memset(a,b,sizeof(a))
#ifdef XLor
  #define dbg(args...) do {cout << #args << " -> "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 200000 + 5;
const int maxv = 100000;

int n, q, a[maxn];

int c[maxn << 2], b[maxn << 2], cov[maxn << 2], rev[maxn << 2];
void pushdown(int rt) {
    int ls = rt << 1, rs = rt << 1 | 1;
    if (cov[rt]) {
        int t = cov[rt];
        cov[ls] = cov[rs] = b[ls] = b[rs] = t;
        rev[rs] = rev[ls] = c[ls] = c[rs] = 0;
        cov[rt] = 0;
    }
    else if (rev[rt]) {
        int t = rev[rt];
        if (b[ls]) {
            b[ls] = -b[ls]; cov[ls] = b[ls];
            rev[ls] = c[ls] = 0;
        } else {
            c[ls] ^= 1; rev[ls] ^= 1;
        }
        if (b[rs]) {
            b[rs] = -b[rs]; cov[rs] = b[rs];
            rev[rs] = c[rs] = 0;
        } else {
            c[rs] ^= 1; rev[rs] ^= 1;
        }
        rev[rt] = 0;
    }
}
void update1(int L, int R, int x, int l, int r, int rt) {
    if (L <= l && r <= R) {
        b[rt] = x; cov[rt] = x; rev[rt] = c[rt] = 0;
        return ;
    }
    // dbg(l, r, rt);
    int m = (l + r) / 2; pushdown(rt);
    if (L <= m) update1(L, R, x, lson);
    if (R > m) update1(L, R, x, rson);
}
void update2(int L, int R, int l, int r, int rt) {
    if (L <= l && r <= R) {
        if (b[rt]) {
            b[rt] = -b[rt]; cov[rt] = b[rt];
            rev[rt] = c[rt] = 0;
        } else {
            c[rt] ^= 1; rev[rt] ^= 1;
        }
        return ;
    }
    int m = (l + r) / 2; pushdown(rt);
    if (L <= m) update2(L, R, lson);
    if (R > m) update2(L, R, rson);
}
int d[maxn];
void build(int l, int r, int rt) {
    if (l == r) {
        if (b[rt]) {
            if (c[rt]) {
                d[l] = -b[rt];
            } else {
                d[l] = b[rt];
            }
        } else {
            if (c[rt]) d[l] = 2;
            else d[l] = 0;
        }
        return ;
    }
    int m = (l + r) / 2; pushdown(rt);
    build(lson); build(rson);
}

int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    char op[2]; int x;
    while (q--) {
        scanf("%s%d", op, &x);
        if (op[0] == '<') {
            if (x <= 0) {
                update1(-x + 1, maxv, 1, 0, maxv, 1);
            } else {
                update1(x, maxv, 1, 0, maxv, 1);
                update2(0, x - 1, 0, maxv, 1);
            }
        } else if (op[0] == '>') {
            if (x >= 0) {
                update1(x + 1, maxv, -1, 0, maxv, 1);
            } else {
                update1(-x, maxv, -1, 0, maxv, 1);
                update2(0, -x - 1, 0, maxv, 1);
            }
        }
        // build(0, maxv, 1);
        // for (int i = 0; i <= 5; i++) {
        //     dbg(d[i]);
        // }
        // for (int i = 1; i <= n; i++) {
        //     int t = d[abs(a[i])];
        //     if (t == 0) printf("%2d ", a[i]);
        //     else if (t == 1) printf("%2d ", abs(a[i]));
        //     else if (t == -1) printf("%2d ", -abs(a[i]));
        //     else printf("%2d ", -a[i]);
        // }
        // puts("");
    }
    build(0, maxv, 1);
    for (int i = 1; i <= n; i++) {
        int t = d[abs(a[i])];
        if (t == 0) printf("%d ", a[i]);
        else if (t == 1) printf("%d ", abs(a[i]));
        else if (t == -1) printf("%d ", -abs(a[i]));
        else printf("%d ", -a[i]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <assert.h>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define ms(a,b) memset(a,b,sizeof(a))
#ifdef XLor
  #define dbg(args...) do {cout << #args << " -> "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 200000 + 5;
const int maxv = 100000;

int n, q, a[maxn];

int c[maxn << 2], b[maxn << 2], cov[maxn << 2], rev[maxn << 2];
void pushdown(int rt) {
    int ls = rt << 1, rs = rt << 1 | 1;
    assert(cov[rt] == 0 || rev[rt] == 0);
    if (cov[rt]) {
        int t = cov[rt];
        cov[ls] = cov[rs] = b[ls] = b[rs] = t;
        rev[rs] = rev[ls] = c[ls] = c[rs] = 0;
        cov[rt] = 0;
    }
    if (rev[rt]) {
        int t = rev[rt];
        if (b[ls]) {
            b[ls] = -b[ls]; cov[ls] = b[ls];
            rev[ls] = c[ls] = 0;
        } else {
            c[ls] ^= 1; rev[ls] ^= 1;
        }
        if (b[rs]) {
            b[rs] = -b[rs]; cov[rs] = b[rs];
            rev[rs] = c[rs] = 0;
        } else {
            c[rs] ^= 1; rev[rs] ^= 1;
        }
        rev[rt] = 0;
    }
}
void update1(int L, int R, int x, int l, int r, int rt) {
    if (L <= l && r <= R) {
        b[rt] = x; cov[rt] = x; rev[rt] = c[rt] = 0;
        return ;
    }
    // dbg(l, r, rt);
    int m = (l + r) / 2; pushdown(rt);
    if (L <= m) update1(L, R, x, lson);
    if (R > m) update1(L, R, x, rson);
}
void update2(int L, int R, int l, int r, int rt) {
    if (L <= l && r <= R) {
        if (b[rt]) {
            b[rt] = -b[rt]; cov[rt] = b[rt];
            rev[rt] = c[rt] = 0;
        } else {
            c[rt] ^= 1; rev[rt] ^= 1;
        }
        return ;
    }
    int m = (l + r) / 2; pushdown(rt);
    if (L <= m) update2(L, R, lson);
    if (R > m) update2(L, R, rson);
}
int d[maxn];
void build(int l, int r, int rt) {
    if (l == r) {
        if (b[rt]) {
            if (c[rt]) {
                d[l] = -b[rt];
            } else {
                d[l] = b[rt];
            }
        } else {
            if (c[rt]) d[l] = 2;
            else d[l] = 0;
        }
        return ;
    }
    int m = (l + r) / 2; pushdown(rt);
    build(lson); build(rson);
}

int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    char op[2]; int x;
    while (q--) {
        scanf("%s%d", op, &x);
        if (op[0] == '<') {
            if (x <= 0) {
                update1(-x + 1, maxv, 1, 1, maxv, 1);
            } else {
                update1(x, maxv, 1, 1, maxv, 1);
                if (x == 1) continue;
                update2(1, x - 1, 1, maxv, 1);
            }
        } else if (op[0] == '>') {
            if (x >= 0) {
                update1(x + 1, maxv, -1, 1, maxv, 1);
            } else {
                update1(-x, maxv, -1, 1, maxv, 1);
                if (x == -1) continue;
                update2(1, -x - 1, 1, maxv, 1);
            }
        }
        // build(0, maxv, 1);
        // for (int i = 0; i <= 5; i++) {
        //     dbg(d[i]);
        // }
        // for (int i = 1; i <= n; i++) {
        //     int t = d[abs(a[i])];
        //     if (t == 0) printf("%2d ", a[i]);
        //     else if (t == 1) printf("%2d ", abs(a[i]));
        //     else if (t == -1) printf("%2d ", -abs(a[i]));
        //     else printf("%2d ", -a[i]);
        // }
        // puts("");
    }
    build(1, maxv, 1);
    for (int i = 1; i <= n; i++) {
        int t = d[abs(a[i])];
        if (t == 0) printf("%d ", a[i]);
        else if (t == 1) printf("%d ", abs(a[i]));
        else if (t == -1) printf("%d ", -abs(a[i]));
        else printf("%d ", -a[i]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <assert.h>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define ms(a,b) memset(a,b,sizeof(a))
#ifdef XLor
  #define dbg(args...) do {cout << #args << " -> "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 200000 + 5;
const int maxv = 100000;

int n, q, a[maxn];

int c[maxn << 2], b[maxn << 2], cov[maxn << 2], rev[maxn << 2];
void pushdown(int rt) {
    int ls = rt << 1, rs = rt << 1 | 1;
    assert(cov[rt] == 0 || rev[rt] == 0);
    if (cov[rt]) {
        int t = cov[rt];
        cov[ls] = cov[rs] = b[ls] = b[rs] = t;
        rev[rs] = rev[ls] = c[ls] = c[rs] = 0;
        cov[rt] = 0;
    }
    if (rev[rt]) {
        int t = rev[rt];
        if (b[ls]) {
            b[ls] = -b[ls]; cov[ls] = b[ls];
            rev[ls] = c[ls] = 0;
        } else {
            c[ls] ^= 1; rev[ls] ^= 1;
        }
        if (b[rs]) {
            b[rs] = -b[rs]; cov[rs] = b[rs];
            rev[rs] = c[rs] = 0;
        } else {
            c[rs] ^= 1; rev[rs] ^= 1;
        }
        rev[rt] = 0;
    }
}
void update1(int L, int R, int x, int l, int r, int rt) {
    if (L <= l && r <= R) {
        b[rt] = x; cov[rt] = x; rev[rt] = c[rt] = 0;
        return ;
    }
    // dbg(l, r, rt);
    int m = (l + r) / 2; pushdown(rt);
    if (L <= m) update1(L, R, x, lson);
    if (R > m) update1(L, R, x, rson);
}
void update2(int L, int R, int l, int r, int rt) {
    if (L <= l && r <= R) {
        if (b[rt]) {
            b[rt] = -b[rt]; cov[rt] = b[rt];
            rev[rt] = c[rt] = 0;
        } else {
            c[rt] ^= 1; rev[rt] ^= 1;
        }
        return ;
    }
    int m = (l + r) / 2; pushdown(rt);
    if (L <= m) update2(L, R, lson);
    if (R > m) update2(L, R, rson);
}
int d[maxn];
void build(int l, int r, int rt) {
    if (l == r) {
        if (b[rt]) {
            if (c[rt]) {
                d[l] = -b[rt];
            } else {
                d[l] = b[rt];
            }
        } else {
            if (c[rt]) d[l] = 2;
            else d[l] = 0;
        }
        return ;
    }
    int m = (l + r) / 2; pushdown(rt);
    build(lson); build(rson);
}

int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    char op[2]; int x;
    while (q--) {
        scanf("%s%d", op, &x);
        if (op[0] == '<') {
            if (x <= 0) {
                update1(-x + 1, maxv, 1, 1, maxv, 1);
            } else {
                update1(x, maxv, 1, 1, maxv, 1);
                update2(0, x - 1, 1, maxv, 1);
            }
        } else if (op[0] == '>') {
            if (x >= 0) {
                update1(x + 1, maxv, -1, 1, maxv, 1);
            } else {
                update1(-x, maxv, -1, 1, maxv, 1);
                update2(0, -x - 1, 1, maxv, 1);
            }
        }
        // build(0, maxv, 1);
        // for (int i = 0; i <= 5; i++) {
        //     dbg(d[i]);
        // }
        // for (int i = 1; i <= n; i++) {
        //     int t = d[abs(a[i])];
        //     if (t == 0) printf("%2d ", a[i]);
        //     else if (t == 1) printf("%2d ", abs(a[i]));
        //     else if (t == -1) printf("%2d ", -abs(a[i]));
        //     else printf("%2d ", -a[i]);
        // }
        // puts("");
    }
    build(1, maxv, 1);
    for (int i = 1; i <= n; i++) {
        int t = d[abs(a[i])];
        if (t == 0) printf("%d ", a[i]);
        else if (t == 1) printf("%d ", abs(a[i]));
        else if (t == -1) printf("%d ", -abs(a[i]));
        else printf("%d ", -a[i]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <assert.h>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define ms(a,b) memset(a,b,sizeof(a))
#ifdef XLor
  #define dbg(args...) do {cout << #args << " -> "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 200000 + 5;
const int maxv = 100000;

int n, q, a[maxn];

struct Tree {
    int c[maxn << 2], b[maxn << 2], cov[maxn << 2], rev[maxn << 2];
    void pushdown(int rt) {
        int ls = rt << 1, rs = rt << 1 | 1;
        // assert(cov[rt] == 0 || rev[rt] == 0);
        if (cov[rt]) {
            int t = cov[rt];
            cov[ls] = cov[rs] = b[ls] = b[rs] = t;
            cov[rt] = 0;
        } else if (rev[rt]) {
            b[ls] = -b[ls]; b[rs] = -b[rs];
            if (cov[ls]) cov[ls] = -cov[ls]; else rev[ls] ^= 1;
            if (cov[rs]) cov[rs] = -cov[rs]; else rev[rs] ^= 1;
            rev[rt] = 0;
        }
    }
    void update1(int L, int R, int x, int l, int r, int rt) {
        if (L <= l && r <= R) {
            b[rt] = x; cov[rt] = x; return ;
        }
        int m = (l + r) / 2; pushdown(rt);
        if (L <= m) update1(L, R, x, lson);
        if (R > m) update1(L, R, x, rson);
    }
    void update2(int L, int R, int l, int r, int rt) {
        if (L <= l && r <= R) {
            b[rt] = -b[rt];
            if (cov[rt]) cov[rt] = -cov[rt]; else rev[rt] ^= 1;
            return ;
        }
        int m = (l + r) / 2; pushdown(rt);
        if (L <= m) update2(L, R, lson);
        if (R > m) update2(L, R, rson);
    }
} f1, f2;

int ans[maxn];
void build(int l, int r, int rt) {
    if (l == r) {
        if (f1.b[rt]) ans[l] = f1.b[rt];
        else if (f2.c[rt] == 1) ans[l] = 2;
        else ans[l] = 0;
        return ;
    }
    int m = (l + r) / 2;
    f1.pushdown(rt); f2.pushdown(rt);
    build(lson); build(rson);
}

int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    for (int i = 1; i <= maxv; i++) f2.update1(i, i, -1, 1, maxv, 1);
    char op[2]; int x;
    while (q--) {
        scanf("%s%d", op, &x);
        if (op[0] == '<') {
            if (x <= 0) {
                f1.update1(-x + 1, maxv, 1, 1, maxv, 1);
            } else {
                f1.update1(x, maxv, 1, 1, maxv, 1);
                if (x == 1) continue;
                f1.update2(1, x - 1, 1, maxv, 1);
                f2.update2(1, x - 1, 1, maxv, 1);
            }
        } else if (op[0] == '>') {
            if (x >= 0) {
                f1.update1(x + 1, maxv, -1, 1, maxv, 1);
            } else {
                f1.update1(-x, maxv, -1, 1, maxv, 1);
                if (x == -1) continue;
                f1.update2(1, -x - 1, 1, maxv, 1);
                f2.update2(1, -x - 1, 1, maxv, 1);
            }
        }
        // build(1, maxv, 1);
        // for (int i = 1; i <= 5; i++) {
        //     dbg(i, d[i]);
        // }
        // for (int i = 1; i <= n; i++) {
        //     int t = d[abs(a[i])];
        //     if (t == 0) printf("%2d ", a[i]);
        //     else if (t == 1) printf("%2d ", abs(a[i]));
        //     else if (t == -1) printf("%2d ", -abs(a[i]));
        //     else printf("%2d ", -a[i]);
        // }
        // puts("");
    }
    build(1, maxv, 1);
    for (int i = 1; i <= n; i++) {
        int t = ans[abs(a[i])];
        if (t == 0) printf("%d ", a[i]);
        else if (t == 1) printf("%d ", abs(a[i]));
        else if (t == -1) printf("%d ", -abs(a[i]));
        else printf("%d ", -a[i]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define ms(a,b) memset(a,b,sizeof(a))
#ifdef XLor
  #define dbg(args...) do {cout << #args << " -> "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 200000 + 5;
const int maxv = 100000;

int n, q, a[maxn];

int c[maxn << 2], b[maxn << 2], cov[maxn << 2], rev[maxn << 2];
void pushdown(int rt) {
    int ls = rt << 1, rs = rt << 1 | 1;
    if (cov[rt]) {
        int t = cov[rt];
        cov[ls] = cov[rs] = b[ls] = b[rs] = t;
        rev[rs] = rev[ls] = c[ls] = c[rs] = 0;
        cov[rt] = 0;
    }
    if (rev[rt]) {
        int t = rev[rt];
        if (b[ls]) {
            b[ls] = -b[ls]; cov[ls] = b[ls];
            rev[ls] = c[ls] = 0;
        } else {
            c[ls] ^= 1; rev[ls] ^= 1;
        }
        if (b[rs]) {
            b[rs] = -b[rs]; cov[rs] = b[rs];
            rev[rs] = c[rs] = 0;
        } else {
            c[rs] ^= 1; rev[rs] ^= 1;
        }
        rev[rt] = 0;
    }
}
void update1(int L, int R, int x, int l, int r, int rt) {
    if (L <= l && r <= R) {
        b[rt] = x; cov[rt] = x; rev[rt] = c[rt] = 0;
        return ;
    }
    // dbg(l, r, rt);
    int m = (l + r) / 2; pushdown(rt);
    if (L <= m) update1(L, R, x, lson);
    if (R > m) update1(L, R, x, rson);
}
void update2(int L, int R, int l, int r, int rt) {
    if (L <= l && r <= R) {
        if (b[rt]) {
            b[rt] = -b[rt]; cov[rt] = b[rt];
            rev[rt] = c[rt] = 0;
        } else {
            c[rt] ^= 1; rev[rt] ^= 1;
        }
        return ;
    }
    int m = (l + r) / 2; pushdown(rt);
    if (L <= m) update2(L, R, lson);
    if (R > m) update2(L, R, rson);
}
int d[maxn];
void build(int l, int r, int rt) {
    if (l == r) {
        if (b[rt]) {
            if (c[rt]) {
                d[l] = -b[rt];
            } else {
                d[l] = b[rt];
            }
        } else {
            if (c[rt]) d[l] = 2;
            else d[l] = 0;
        }
        return ;
    }
    int m = (l + r) / 2; pushdown(rt);
    build(lson); build(rson);
}

int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    char op[2]; int x;
    while (q--) {
        scanf("%s%d", op, &x);
        if (op[0] == '<') {
            if (x <= 0) {
                update1(-x + 1, maxv, 1, 0, maxv, 1);
            } else {
                update1(x, maxv, 1, 0, maxv, 1);
                update2(0, x - 1, 0, maxv, 1);
            }
        } else if (op[0] == '>') {
            if (x >= 0) {
                update1(x + 1, maxv, -1, 0, maxv, 1);
            } else {
                update1(-x, maxv, -1, 0, maxv, 1);
                update2(0, -x - 1, 0, maxv, 1);
            }
        }
        // build(0, maxv, 1);
        // for (int i = 0; i <= 5; i++) {
        //     dbg(d[i]);
        // }
        // for (int i = 1; i <= n; i++) {
        //     int t = d[abs(a[i])];
        //     if (t == 0) printf("%2d ", a[i]);
        //     else if (t == 1) printf("%2d ", abs(a[i]));
        //     else if (t == -1) printf("%2d ", -abs(a[i]));
        //     else printf("%2d ", -a[i]);
        // }
        // puts("");
    }
    build(0, maxv, 1);
    for (int i = 1; i <= n; i++) {
        int t = d[abs(a[i])];
        if (t == 0) printf("%d ", a[i]);
        else if (t == 1) printf("%d ", abs(a[i]));
        else if (t == -1) printf("%d ", -abs(a[i]));
        else printf("%d ", -a[i]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <assert.h>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define ms(a,b) memset(a,b,sizeof(a))
#ifdef XLor
  #define dbg(args...) do {cout << #args << " -> "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 200000 + 5;
const int maxv = 100000;

int n, q, a[maxn];

int c[maxn << 2], b[maxn << 2], cov[maxn << 2], rev[maxn << 2];
void pushdown(int rt) {
    int ls = rt << 1, rs = rt << 1 | 1;
    assert(cov[rt] == 0 || rev[rt] == 0);
    if (cov[rt]) {
        int t = cov[rt];
        cov[ls] = cov[rs] = b[ls] = b[rs] = t;
        rev[rs] = rev[ls] = c[ls] = c[rs] = 0;
        cov[rt] = 0;
    }
    if (rev[rt]) {
        int t = rev[rt];
        if (b[ls]) {
            b[ls] = -b[ls]; cov[ls] = b[ls];
            rev[ls] = c[ls] = 0;
        } else {
            c[ls] ^= 1; rev[ls] ^= 1;
        }
        if (b[rs]) {
            b[rs] = -b[rs]; cov[rs] = b[rs];
            rev[rs] = c[rs] = 0;
        } else {
            c[rs] ^= 1; rev[rs] ^= 1;
        }
        rev[rt] = 0;
    }
}
void update1(int L, int R, int x, int l, int r, int rt) {
    if (L <= l && r <= R) {
        b[rt] = x; cov[rt] = x; rev[rt] = c[rt] = 0;
        return ;
    }
    // dbg(l, r, rt);
    int m = (l + r) / 2; pushdown(rt);
    if (L <= m) update1(L, R, x, lson);
    if (R > m) update1(L, R, x, rson);
}
void update2(int L, int R, int l, int r, int rt) {
    if (L <= l && r <= R) {
        if (b[rt]) {
            b[rt] = -b[rt]; cov[rt] = b[rt];
            rev[rt] = c[rt] = 0;
        } else {
            c[rt] ^= 1; rev[rt] ^= 1;
        }
        return ;
    }
    int m = (l + r) / 2; pushdown(rt);
    if (L <= m) update2(L, R, lson);
    if (R > m) update2(L, R, rson);
}
int d[maxn];
void build(int l, int r, int rt) {
    if (l == r) {
        if (b[rt]) {
            if (c[rt]) {
                d[l] = -b[rt];
            } else {
                d[l] = b[rt];
            }
        } else {
            if (c[rt]) d[l] = 2;
            else d[l] = 0;
        }
        return ;
    }
    int m = (l + r) / 2; pushdown(rt);
    build(lson); build(rson);
}

int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    char op[2]; int x;
    while (q--) {
        scanf("%s%d", op, &x);
        if (op[0] == '<') {
            if (x <= 0) {
                update1(-x + 1, maxv, 1, 0, maxv, 1);
            } else {
                update1(x, maxv, 1, 0, maxv, 1);
                update2(0, x - 1, 0, maxv, 1);
            }
        } else if (op[0] == '>') {
            if (x >= 0) {
                update1(x + 1, maxv, -1, 0, maxv, 1);
            } else {
                update1(-x, maxv, -1, 0, maxv, 1);
                update2(0, -x - 1, 0, maxv, 1);
            }
        }
        // build(0, maxv, 1);
        // for (int i = 0; i <= 5; i++) {
        //     dbg(d[i]);
        // }
        // for (int i = 1; i <= n; i++) {
        //     int t = d[abs(a[i])];
        //     if (t == 0) printf("%2d ", a[i]);
        //     else if (t == 1) printf("%2d ", abs(a[i]));
        //     else if (t == -1) printf("%2d ", -abs(a[i]));
        //     else printf("%2d ", -a[i]);
        // }
        // puts("");
    }
    build(0, maxv, 1);
    for (int i = 1; i <= n; i++) {
        int t = d[abs(a[i])];
        if (t == 0) printf("%d ", a[i]);
        else if (t == 1) printf("%d ", abs(a[i]));
        else if (t == -1) printf("%d ", -abs(a[i]));
        else printf("%d ", -a[i]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <assert.h>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define ms(a,b) memset(a,b,sizeof(a))
#ifdef XLor
  #define dbg(args...) do {cout << #args << " -> "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 200000 + 5;
const int maxv = 100000;

int n, q, a[maxn];

struct Tree {
    int c[maxn << 2], b[maxn << 2], cov[maxn << 2], rev[maxn << 2];
    void pushdown(int rt) {
        int ls = rt << 1, rs = rt << 1 | 1;
        // assert(cov[rt] == 0 || rev[rt] == 0);
        if (cov[rt]) {
            int t = cov[rt];
            cov[ls] = cov[rs] = b[ls] = b[rs] = t;
            cov[rt] = 0;
        } else if (rev[rt]) {
            b[ls] = -b[ls]; b[rs] = -b[rs];
            if (cov[ls]) cov[ls] = -cov[ls]; else rev[ls] ^= 1;
            if (cov[rs]) cov[rs] = -cov[rs]; else rev[rs] ^= 1;
            rev[rt] = 0;
        }
    }
    void update1(int L, int R, int x, int l, int r, int rt) {
        if (L <= l && r <= R) {
            b[rt] = x; cov[rt] = x; return ;
        }
        int m = (l + r) / 2; pushdown(rt);
        if (L <= m) update1(L, R, x, lson);
        if (R > m) update1(L, R, x, rson);
    }
    void update2(int L, int R, int l, int r, int rt) {
        if (L <= l && r <= R) {
            b[rt] = -b[rt];
            if (cov[rt]) cov[rt] = -cov[rt]; else rev[rt] ^= 1;
            return ;
        }
        int m = (l + r) / 2; pushdown(rt);
        if (L <= m) update2(L, R, lson);
        if (R > m) update2(L, R, rson);
    }
} f1, f2;

int ans[maxn];
void build(int l, int r, int rt) {
    if (l == r) {
        if (f1.b[rt]) ans[l] = f1.b[rt];
        else if (f2.b[rt] == 1) ans[l] = 2;
        else ans[l] = 0;
        return ;
    }
    int m = (l + r) / 2;
    f1.pushdown(rt); f2.pushdown(rt);
    build(lson); build(rson);
}

int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    for (int i = 1; i <= maxv; i++) f2.update1(i, i, -1, 1, maxv, 1);
    char op[2]; int x;
    while (q--) {
        scanf("%s%d", op, &x);
        if (op[0] == '<') {
            if (x <= 0) {
                f1.update1(-x + 1, maxv, 1, 1, maxv, 1);
            } else {
                f1.update1(x, maxv, 1, 1, maxv, 1);
                if (x == 1) continue;
                f1.update2(1, x - 1, 1, maxv, 1);
                f2.update2(1, x - 1, 1, maxv, 1);
            }
        } else if (op[0] == '>') {
            if (x >= 0) {
                f1.update1(x + 1, maxv, -1, 1, maxv, 1);
            } else {
                f1.update1(-x, maxv, -1, 1, maxv, 1);
                if (x == -1) continue;
                f1.update2(1, -x - 1, 1, maxv, 1);
                f2.update2(1, -x - 1, 1, maxv, 1);
            }
        }
        // build(1, maxv, 1);
        // for (int i = 1; i <= 5; i++) {
        //     dbg(i, d[i]);
        // }
        // for (int i = 1; i <= n; i++) {
        //     int t = d[abs(a[i])];
        //     if (t == 0) printf("%2d ", a[i]);
        //     else if (t == 1) printf("%2d ", abs(a[i]));
        //     else if (t == -1) printf("%2d ", -abs(a[i]));
        //     else printf("%2d ", -a[i]);
        // }
        // puts("");
    }
    build(1, maxv, 1);
    for (int i = 1; i <= n; i++) {
        int t = ans[abs(a[i])];
        if (t == 0) printf("%d ", a[i]);
        else if (t == 1) printf("%d ", abs(a[i]));
        else if (t == -1) printf("%d ", -abs(a[i]));
        else printf("%d ", -a[i]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <assert.h>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define ms(a,b) memset(a,b,sizeof(a))
#ifdef XLor
  #define dbg(args...) do {cout << #args << " -> "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 200000 + 5;
const int maxv = 100000;

int n, q, a[maxn];

struct Tree {
    int b[maxn << 2], cov[maxn << 2], rev[maxn << 2];
    void pushdown(int rt) {
        int ls = rt << 1, rs = rt << 1 | 1;
        if (cov[rt]) {
            int t = cov[rt];
            cov[ls] = cov[rs] = b[ls] = b[rs] = t;
            cov[rt] = rev[rt] = 0;
        } else if (rev[rt]) {
            b[ls] = -b[ls]; b[rs] = -b[rs];
            if (cov[ls]) cov[ls] = -cov[ls]; else rev[ls] ^= 1;
            if (cov[rs]) cov[rs] = -cov[rs]; else rev[rs] ^= 1;
            rev[rt] = 0;
        }
    }
    void update1(int L, int R, int x, int l, int r, int rt) {
        if (L <= l && r <= R) {
            b[rt] = x; cov[rt] = x; return ;
        }
        int m = (l + r) / 2; pushdown(rt);
        if (L <= m) update1(L, R, x, lson);
        if (R > m) update1(L, R, x, rson);
    }
    void update2(int L, int R, int l, int r, int rt) {
        if (L <= l && r <= R) {
            b[rt] = -b[rt];
            if (cov[rt]) cov[rt] = -cov[rt]; else rev[rt] ^= 1;
            return ;
        }
        int m = (l + r) / 2; pushdown(rt);
        if (L <= m) update2(L, R, lson);
        if (R > m) update2(L, R, rson);
    }
} f1, f2;

int ans[maxn];
void build(int l, int r, int rt) {
    if (l == r) {
        if (f1.b[rt]) ans[l] = f1.b[rt];
        else if (f2.b[rt] == 1) ans[l] = 2;
        else ans[l] = 0;
        return ;
    }
    int m = (l + r) / 2;
    f1.pushdown(rt); f2.pushdown(rt);
    build(lson); build(rson);
}

int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    f2.update1(1, maxv, -1, 1, maxv, 1);
    char op[2]; int x;
    while (q--) {
        scanf("%s%d", op, &x);
        if (op[0] == '<') {
            if (x <= 0) {
                f1.update1(-x + 1, maxv, 1, 1, maxv, 1);
            } else {
                f1.update1(x, maxv, 1, 1, maxv, 1);
                if (x == 1) continue;
                f1.update2(1, x - 1, 1, maxv, 1);
                f2.update2(1, x - 1, 1, maxv, 1);
            }
        } else if (op[0] == '>') {
            if (x >= 0) {
                f1.update1(x + 1, maxv, -1, 1, maxv, 1);
            } else {
                f1.update1(-x, maxv, -1, 1, maxv, 1);
                if (x == -1) continue;
                f1.update2(1, -x - 1, 1, maxv, 1);
                f2.update2(1, -x - 1, 1, maxv, 1);
            }
        }
    }
    build(1, maxv, 1);
    for (int i = 1; i <= n; i++) {
        int t = ans[abs(a[i])];
        if (t == 0) printf("%d ", a[i]);
        else if (t == 1) printf("%d ", abs(a[i]));
        else if (t == -1) printf("%d ", -abs(a[i]));
        else printf("%d ", -a[i]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <assert.h>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define ms(a,b) memset(a,b,sizeof(a))
#ifdef XLor
  #define dbg(args...) do {cout << #args << " -> "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 200000 + 5;
const int maxv = 100000;

int n, q, a[maxn];

struct Tree {
    int b[maxn << 2], cov[maxn << 2], rev[maxn << 2];
    void pushdown(int rt) {
        int ls = rt << 1, rs = rt << 1 | 1;
        if (cov[rt]) {
            int t = cov[rt];
            cov[ls] = cov[rs] = b[ls] = b[rs] = t;
            cov[rt] = rev[rt] = 0;
        } else if (rev[rt]) {
            b[ls] = -b[ls]; b[rs] = -b[rs];
            if (cov[ls]) cov[ls] = -cov[ls]; else rev[ls] ^= 1;
            if (cov[rs]) cov[rs] = -cov[rs]; else rev[rs] ^= 1;
            rev[rt] = 0;
        }
    }
    void update1(int L, int R, int x, int l, int r, int rt) {
        if (L <= l && r <= R) {
            b[rt] = x; cov[rt] = x; return ;
        }
        int m = (l + r) / 2; pushdown(rt);
        if (L <= m) update1(L, R, x, lson);
        if (R > m) update1(L, R, x, rson);
    }
    void update2(int L, int R, int l, int r, int rt) {
        if (L <= l && r <= R) {
            b[rt] = -b[rt];
            if (cov[rt]) cov[rt] = -cov[rt]; else rev[rt] ^= 1;
            return ;
        }
        int m = (l + r) / 2; pushdown(rt);
        if (L <= m) update2(L, R, lson);
        if (R > m) update2(L, R, rson);
    }
} f1, f2;

int ans[maxn];
void build(int l, int r, int rt) {
    if (l == r) {
        if (f1.b[rt]) ans[l] = f1.b[rt];
        else if (f2.b[rt] == 1) ans[l] = 2;
        else ans[l] = 0;
        return ;
    }
    int m = (l + r) / 2;
    f1.pushdown(rt); f2.pushdown(rt);
    build(lson); build(rson);
}

int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    for (int i = 1; i <= maxv; i++) f2.update1(i, i, -1, 1, maxv, 1);
    // f2.update1(1, maxv, -1, 1, maxv, 1);
    char op[2]; int x;
    while (q--) {
        scanf("%s%d", op, &x);
        if (op[0] == '<') {
            if (x <= 0) {
                f1.update1(-x + 1, maxv, 1, 1, maxv, 1);
            } else {
                f1.update1(x, maxv, 1, 1, maxv, 1);
                if (x == 1) continue;
                f1.update2(1, x - 1, 1, maxv, 1);
                f2.update2(1, x - 1, 1, maxv, 1);
            }
        } else if (op[0] == '>') {
            if (x >= 0) {
                f1.update1(x + 1, maxv, -1, 1, maxv, 1);
            } else {
                f1.update1(-x, maxv, -1, 1, maxv, 1);
                if (x == -1) continue;
                f1.update2(1, -x - 1, 1, maxv, 1);
                f2.update2(1, -x - 1, 1, maxv, 1);
            }
        }
        // build(1, maxv, 1);
        // for (int i = 1; i <= 5; i++) {
        //     dbg(i, d[i]);
        // }
        // for (int i = 1; i <= n; i++) {
        //     int t = d[abs(a[i])];
        //     if (t == 0) printf("%2d ", a[i]);
        //     else if (t == 1) printf("%2d ", abs(a[i]));
        //     else if (t == -1) printf("%2d ", -abs(a[i]));
        //     else printf("%2d ", -a[i]);
        // }
        // puts("");
    }
    build(1, maxv, 1);
    for (int i = 1; i <= n; i++) {
        int t = ans[abs(a[i])];
        if (t == 0) printf("%d ", a[i]);
        else if (t == 1) printf("%d ", abs(a[i]));
        else if (t == -1) printf("%d ", -abs(a[i]));
        else printf("%d ", -a[i]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <assert.h>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define ms(a,b) memset(a,b,sizeof(a))
#ifdef XLor
  #define dbg(args...) do {cout << #args << " -> "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 200000 + 5;
const int maxv = 100000;

int n, q, a[maxn];

struct Tree {
    int b[maxn << 2], cov[maxn << 2], rev[maxn << 2];
    void pushdown(int rt) {
        int ls = rt << 1, rs = rt << 1 | 1;
        if (cov[rt]) {
            int t = cov[rt];
            cov[ls] = cov[rs] = b[ls] = b[rs] = t;
            cov[rt] = rev[rt] = 0;
        } else if (rev[rt]) {
            b[ls] = -b[ls]; b[rs] = -b[rs];
            if (cov[ls]) cov[ls] = -cov[ls]; else rev[ls] ^= 1;
            if (cov[rs]) cov[rs] = -cov[rs]; else rev[rs] ^= 1;
            rev[rt] = 0;
        }
    }
    void update1(int L, int R, int x, int l, int r, int rt) {
        if (L <= l && r <= R) {
            b[rt] = x; cov[rt] = x; return ;
        }
        int m = (l + r) / 2; pushdown(rt);
        if (L <= m) update1(L, R, x, lson);
        if (R > m) update1(L, R, x, rson);
    }
    void update2(int L, int R, int l, int r, int rt) {
        if (L <= l && r <= R) {
            b[rt] = -b[rt];
            if (cov[rt]) cov[rt] = -cov[rt]; else rev[rt] ^= 1;
            return ;
        }
        int m = (l + r) / 2; pushdown(rt);
        if (L <= m) update2(L, R, lson);
        if (R > m) update2(L, R, rson);
    }
} f1, f2;

int ans[maxn];
void build(int l, int r, int rt) {
    if (l == r) {
        if (f1.b[rt]) ans[l] = f1.b[rt];
        else if (f2.b[rt] == 1) ans[l] = 2;
        else ans[l] = 0;
        return ;
    }
    int m = (l + r) / 2;
    f1.pushdown(rt); f2.pushdown(rt);
    build(lson); build(rson);
}

int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    f2.update1(1, maxv, -1, 1, maxv, 1);
    char op[2]; int x;
    while (q--) {
        scanf("%s%d", op, &x);
        if (op[0] == '<') {
            if (x <= 0) {
                f1.update1(-x + 1, maxv, 1, 1, maxv, 1);
            } else {
                f1.update1(x, maxv, 1, 1, maxv, 1);
                if (x == 1) continue;
                f1.update2(1, x - 1, 1, maxv, 1);
                f2.update2(1, x - 1, 1, maxv, 1);
            }
        } else if (op[0] == '>') {
            if (x >= 0) {
                f1.update1(x + 1, maxv, -1, 1, maxv, 1);
            } else {
                f1.update1(-x, maxv, -1, 1, maxv, 1);
                if (x == -1) continue;
                f1.update2(1, -x - 1, 1, maxv, 1);
                f2.update2(1, -x - 1, 1, maxv, 1);
            }
        }
        // build(1, maxv, 1);
        // for (int i = 1; i <= 5; i++) {
        //     dbg(i, d[i]);
        // }
        // for (int i = 1; i <= n; i++) {
        //     int t = d[abs(a[i])];
        //     if (t == 0) printf("%2d ", a[i]);
        //     else if (t == 1) printf("%2d ", abs(a[i]));
        //     else if (t == -1) printf("%2d ", -abs(a[i]));
        //     else printf("%2d ", -a[i]);
        // }
        // puts("");
    }
    build(1, maxv, 1);
    for (int i = 1; i <= n; i++) {
        int t = ans[abs(a[i])];
        if (t == 0) printf("%d ", a[i]);
        else if (t == 1) printf("%d ", abs(a[i]));
        else if (t == -1) printf("%d ", -abs(a[i]));
        else printf("%d ", -a[i]);
    }
    return 0;
}


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

using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ll = long long int;
using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using cdouble = complex<double>;

const double eps = 1e-7;
#define Loop(i, n) for(int i = 0; i < int(n); i++)
#define Loopll(i, n) for(ll i = 0; i < ll(n); i++)
#define Loop1(i, n) for(int i = 1; i <= int(n); i++)
#define Loopll1(i, n) for(ll i = 1; i <= ll(n); i++)
#define Loopr(i, n) for(int i = int(n) - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = ll(n) - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = int(n); i >= 1; i--)
#define Looprll1(i, n) for(ll i = ll(n); i >= 1; i--)
#define Foreach(buf, container) for(auto buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(ex_i, vector.size()) { cout << vector[ex_i] << " "; } cout << endl;
#define printmx(matrix) Loop(ex_i, matrix.size()) { Loop(ex_j, matrix[ex_i].size()) { cout << matrix[ex_i][ex_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
#define fst first
#define snd second
#define INF INFINITY
bool feq(double x, double y) { return abs(x - y) <= eps; }
bool inrange(ll x, ll t) { return x >= 0 && x < t; }
bool inrange(vll xs, ll t) { Foreach(x, xs) if (!(x >= 0 && x < t)) return false; return true; }
int ceillog2(ll x) { int ret = 0;	x--; while (x > 0) { ret++; x >>= 1; } return ret; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (m * m <= x ? 0 : -1); }
ll ceilsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

/*******************************************************/

class SegTree {
private:
	struct val_t {
		bool enable;
		ll upd, add, min;
	};
	int n, N; // n is the original size, while N is the extended size
	int base;
	vector<val_t> nodes;
	int left_of(int id) {
		if (id >= base) return -1;
		else return id * 2 + 1;
	}
	int right_of(int id) {
		if (id >= base) return -1;
		else return id * 2 + 2;
	}
	int parent_of(int id) {
		if (id == 0) return -1;
		else return (id - 1) >> 1;
	}
	void merge(int id, int id_l, int id_r) {
		nodes[id].min = min(nodes[id_l].min + nodes[id_l].add, nodes[id_r].min + nodes[id_r].add);
	}
	void lazy_rec(int s, int t, int l, int r, int id, ll upd, ll add, bool enable) {
		if (s == l && t == r) {
			if (enable) nodes[id] = { true, upd, add, upd };
			else nodes[id].add ^= add;
		}
		else {
			int m = (l + r) / 2;
			int id_l = left_of(id);
			int id_r = right_of(id);
			if (!enable) {
				add ^= nodes[id].add;
				if (nodes[id].enable) {
					upd = nodes[id].upd;
					enable = true;
				}
			}
			nodes[id].enable = false;
			nodes[id].add = 0;
			if (s < m && m < t) {
				lazy_rec(s, m, l, m, id_l, upd, add, enable);
				lazy_rec(m, t, m, r, id_r, upd, add, enable);
			}
			else if (s < m) {
				lazy_rec(s, t, l, m, id_l, upd, add, enable);
				lazy_rec(0, 0, 0, 0, id_r, upd, add, enable);
			}
			else if (m < t) {
				lazy_rec(0, 0, 0, 0, id_l, upd, add, enable);
				lazy_rec(s, t, m, r, id_r, upd, add, enable);
			}
			merge(id, id_l, id_r);
		}
	}
	enum change_t {
		UPD, ADD
	};
	void change_rec(int s, int t, int l, int r, int id, ll x, change_t op) {
		if (s == l && t == r) {
			if (op == UPD) nodes[id] = { true, x, 0, x };
			else if (op == ADD) nodes[id].add ^= x;
		}
		else {
			int m = (l + r) / 2;
			int id_l = left_of(id);
			int id_r = right_of(id);
			if (s < m && m < t) {
				change_rec(s, m, l, m, id_l, x, op);
				change_rec(m, t, m, r, id_r, x, op);
			}
			else if (s < m) {
				change_rec(s, t, l, m, id_l, x, op);
			}
			else if (m < t) {
				change_rec(s, t, m, r, id_r, x, op);
			}
			merge(id, id_l, id_r);
		}
	}
	enum solve_t {
		MIN
	};
	ll solve_rec(int s, int t, int l, int r, int id, solve_t op) {
		ll v = 0;
		if (s == l && t == r) {
			if (op == MIN) v = nodes[id].min;
		}
		else {
			int m = (l + r) / 2;
			int id_l = left_of(id);
			int id_r = right_of(id);
			if (s < m && m < t) {
				ll v0 = solve_rec(s, m, l, m, id_l, op);
				ll v1 = solve_rec(m, t, m, r, id_r, op);
				if (op == MIN) v = min(v0, v1);
			}
			else if (s < m) {
				v = solve_rec(s, t, l, m, id_l, op);
			}
			else if (m < t) {
				v = solve_rec(s, t, m, r, id_r, op);
			}
		}
		if (op == MIN) v ^= nodes[id].add;
		return v;
	}
	void lazy(int s, int t) {
		lazy_rec(s, t, 0, N, 0, 0, 0, false);
	}
public:
	SegTree(int n, ll init) {
		this->n = n;
		N = (int)pow(2, ceil(log2(n)));
		base = N - 1;
		nodes = vector<val_t>(base + N, { false, 0, 0, LLONG_MAX });
		upd(0, n, init);
	}
	int cover_size(int id) {
		int cnt = 1;
		while (left_of(id) != -1) {
			id = left_of(id);
			cnt *= 2;
		}
		int l = id - base;
		int r = min(l + cnt, n);
		return max(0, r - l);
	}
	void upd(int s, int t, ll x) {
		lazy(s, t);
		change_rec(s, t, 0, N, 0, x, UPD);
	}
	void add(int s, int t, ll x) {
		lazy(s, t);
		change_rec(s, t, 0, N, 0, x, ADD);
	}
	ll minof(int s, int t) {
		lazy(s, t);
		return solve_rec(s, t, 0, N, 0, MIN);
	}
};

int main() {
	int n; cin >> n;
	int q; cin >> q;
	vi a(n);
	Loop(i, n) cin >> a[i];
	map<int, int> mp;
	int m = 200003;
	int d = 100000;
	Loop(i, m) {
		mp[i - d] = i;
	}
	SegTree *st = new SegTree(m, 0);
	st->add(mp[-d], mp[0], 1);
	Loop(_, q) {
		char op;
		int x;
		cin >> op >> x;
		if (x == 0) {
			if (op == '>') x = -1;
			else x = 1;
		}
		int y = abs(x);
		if (op == '>' && x < 0) {
			st->add(mp[-y + 1], mp[y], 1);
			st->upd(mp[-d], mp[-y + 1], 1);
			st->upd(mp[y], mp[d + 1], 1);
		}
		else if (op == '<' && x < 0) {
			st->upd(mp[-d], mp[-y], 0);
			st->upd(mp[y + 1], mp[d + 1], 0);
		}
		else if (op == '<' && x > 0) {
			st->add(mp[-y + 1], mp[y], 1);
			st->upd(mp[-d], mp[-y + 1], 0);
			st->upd(mp[y], mp[d + 1], 0);
		}
		else if (op == '>' && x > 0) {
			st->upd(mp[-d], mp[-y], 1);
			st->upd(mp[y + 1], mp[d + 1], 1);
		}
	}
	vi ans(n);
	Loop(i, n) {
		int sign = st->minof(mp[a[i]], mp[a[i] + 1]);
		ans[i] = (sign ? -abs(a[i]) : abs(a[i]));
	}
	printv(ans);
}


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

using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ll = long long int;
using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using cdouble = complex<double>;

const double eps = 1e-7;
#define Loop(i, n) for(int i = 0; i < int(n); i++)
#define Loopll(i, n) for(ll i = 0; i < ll(n); i++)
#define Loop1(i, n) for(int i = 1; i <= int(n); i++)
#define Loopll1(i, n) for(ll i = 1; i <= ll(n); i++)
#define Loopr(i, n) for(int i = int(n) - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = ll(n) - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = int(n); i >= 1; i--)
#define Looprll1(i, n) for(ll i = ll(n); i >= 1; i--)
#define Foreach(buf, container) for(auto buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(ex_i, vector.size()) { cout << vector[ex_i] << " "; } cout << endl;
#define printmx(matrix) Loop(ex_i, matrix.size()) { Loop(ex_j, matrix[ex_i].size()) { cout << matrix[ex_i][ex_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
#define fst first
#define snd second
#define INF INFINITY
bool feq(double x, double y) { return abs(x - y) <= eps; }
bool inrange(ll x, ll t) { return x >= 0 && x < t; }
bool inrange(vll xs, ll t) { Foreach(x, xs) if (!(x >= 0 && x < t)) return false; return true; }
int ceillog2(ll x) { int ret = 0;	x--; while (x > 0) { ret++; x >>= 1; } return ret; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (m * m <= x ? 0 : -1); }
ll ceilsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

/*******************************************************/

class SegTree {
private:
	struct val_t {
		bool enable;
		ll upd, add, min;
	};
	int n, N; // n is the original size, while N is the extended size
	int base;
	vector<val_t> nodes;
	int left_of(int id) {
		if (id >= base) return -1;
		else return id * 2 + 1;
	}
	int right_of(int id) {
		if (id >= base) return -1;
		else return id * 2 + 2;
	}
	int parent_of(int id) {
		if (id == 0) return -1;
		else return (id - 1) >> 1;
	}
	void merge(int id, int id_l, int id_r) {
		nodes[id].min = min(nodes[id_l].min + nodes[id_l].add, nodes[id_r].min + nodes[id_r].add);
	}
	void lazy_rec(int s, int t, int l, int r, int id, ll upd, ll add, bool enable) {
		if (s == l && t == r) {
			if (enable) nodes[id] = { true, upd, add, upd };
			else nodes[id].add ^= add;
		}
		else {
			int m = (l + r) / 2;
			int id_l = left_of(id);
			int id_r = right_of(id);
			if (!enable) {
				add ^= nodes[id].add;
				if (nodes[id].enable) {
					upd = nodes[id].upd;
					enable = true;
				}
			}
			nodes[id].enable = false;
			nodes[id].add = 0;
			if (s < m && m < t) {
				lazy_rec(s, m, l, m, id_l, upd, add, enable);
				lazy_rec(m, t, m, r, id_r, upd, add, enable);
			}
			else if (s < m) {
				lazy_rec(s, t, l, m, id_l, upd, add, enable);
				lazy_rec(0, 0, 0, 0, id_r, upd, add, enable);
			}
			else if (m < t) {
				lazy_rec(0, 0, 0, 0, id_l, upd, add, enable);
				lazy_rec(s, t, m, r, id_r, upd, add, enable);
			}
			merge(id, id_l, id_r);
		}
	}
	enum change_t {
		UPD, ADD
	};
	void change_rec(int s, int t, int l, int r, int id, ll x, change_t op) {
		if (s == l && t == r) {
			if (op == UPD) nodes[id] = { true, x, 0, x };
			else if (op == ADD) nodes[id].add ^= x;
		}
		else {
			int m = (l + r) / 2;
			int id_l = left_of(id);
			int id_r = right_of(id);
			if (s < m && m < t) {
				change_rec(s, m, l, m, id_l, x, op);
				change_rec(m, t, m, r, id_r, x, op);
			}
			else if (s < m) {
				change_rec(s, t, l, m, id_l, x, op);
			}
			else if (m < t) {
				change_rec(s, t, m, r, id_r, x, op);
			}
			merge(id, id_l, id_r);
		}
	}
	enum solve_t {
		MIN
	};
	ll solve_rec(int s, int t, int l, int r, int id, solve_t op) {
		ll v = 0;
		if (s == l && t == r) {
			if (op == MIN) v = nodes[id].min;
		}
		else {
			int m = (l + r) / 2;
			int id_l = left_of(id);
			int id_r = right_of(id);
			if (s < m && m < t) {
				ll v0 = solve_rec(s, m, l, m, id_l, op);
				ll v1 = solve_rec(m, t, m, r, id_r, op);
				if (op == MIN) v = min(v0, v1);
			}
			else if (s < m) {
				v = solve_rec(s, t, l, m, id_l, op);
			}
			else if (m < t) {
				v = solve_rec(s, t, m, r, id_r, op);
			}
		}
		if (op == MIN) v ^= nodes[id].add;
		return v;
	}
	void lazy(int s, int t) {
		lazy_rec(s, t, 0, N, 0, 0, 0, false);
	}
public:
	SegTree(int n, ll init) {
		this->n = n;
		N = (int)pow(2, ceil(log2(n)));
		base = N - 1;
		nodes = vector<val_t>(base + N, { false, 0, 0, LLONG_MAX });
		upd(0, n, init);
	}
	int cover_size(int id) {
		int cnt = 1;
		while (left_of(id) != -1) {
			id = left_of(id);
			cnt *= 2;
		}
		int l = id - base;
		int r = min(l + cnt, n);
		return max(0, r - l);
	}
	void upd(int s, int t, ll x) {
		lazy(s, t);
		change_rec(s, t, 0, N, 0, x, UPD);
	}
	void add(int s, int t, ll x) {
		lazy(s, t);
		change_rec(s, t, 0, N, 0, x, ADD);
	}
	ll minof(int s, int t) {
		lazy(s, t);
		return solve_rec(s, t, 0, N, 0, MIN);
	}
};

int main() {
	int n; cin >> n;
	int q; cin >> q;
	vi a(n);
	Loop(i, n) cin >> a[i];
	map<int, int> mp;
	int m = 200003;
	int d = 100000;
	Loop(i, m) {
		mp[i - d] = i;
	}
	SegTree *st = new SegTree(m, 0);
	st->add(mp[-d], mp[0], 1);
	Loop(_, q) {
		char op;
		int x;
		cin >> op >> x;
		if (x == 0) {
			if (op == '>') x = -1;
			else x = 1;
		}
		int y = abs(x);
		if (op == '>' && x < 0) {
			st->add(mp[-y + 1], mp[y], 1);
			st->upd(mp[-d], mp[-y + 1], 1);
			st->upd(mp[y], mp[d + 1], 1);
		}
		else if (op == '<' && x < 0) {
			st->upd(mp[-d], mp[-y], 0);
			st->upd(mp[y + 1], mp[d + 1], 0);
		}
		else if (op == '<' && x > 0) {
			st->add(mp[-y + 1], mp[y], 1);
			st->upd(mp[-d], mp[-y + 1], 0);
			st->upd(mp[y], mp[d + 1], 0);
		}
		else if (op == '>' && x > 0) {
			st->upd(mp[-d], mp[-y], 1);
			st->upd(mp[y + 1], mp[d + 1], 1);
		}
		vi ans(n);
		Loop(i, n) {
			int sign = st->minof(mp[a[i]], mp[a[i] + 1]);
			ans[i] = (sign ? -abs(a[i]) : abs(a[i]));
		}
		printv(ans);
	}
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;

struct SegmentTree {
    int n;
    vector <int> t;

    void build(const vector <int> &a) {
        for (int i = 0; i < n; ++i) {
            t[n + i] = a[i];
        }
        for (int i = n - 1; i > 0; --i) {
            t[i] = max(t[i << 1], t[i << 1 | 1]);
        }
    }

    void modify(int x, int val) {
        for (t[x += n] = val; x > 1; x >>= 1) {
            t[x >> 1] = max(t[x], t[x ^ 1]);
        }
    }

    int get(int l, int r) {
        ++r;
        int res = -Inf;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (r & 1) res = max(res, t[--r]);
        }
        return res;
    }

    SegmentTree(const vector <int> &a) {
        n = a.size();
        t.resize(2 * n, -Inf);
        build(a);
    }
};

struct fenwick {
    vector <int> f;
    int n;
    fenwick(int nn) {
        n = nn;
        f.resize(n);
    }
    void modify(int i, int val) {
        for (; i < n; i |= i + 1) f[i] += val;
    }
    int get(int i) {
        int res = 0;
        for (; i >= 0; i &= i + 1, --i) res += f[i];
        return res;
    }
    int sum(int l, int r) {
        if (l > r) return 0;
        return get(r) - get(l - 1);
    }
    void clear() {
        for (int i = 0; i < n; ++i) f[i] = 0;
    }
};

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n, q;
    cin >> n >> q;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector <char> s(q);
    vector <int> x(q);
    for (int i = 0; i < q; ++i) {
        cin >> s[i] >> x[i];
    }
    vector <int> id(q);
    iota(id.begin(), id.end(), 0);
    sort(id.begin(), id.end(), [&] (int i, int j) {
        return x[i] < x[j];
    });

    vector <int> idl = id;
    vector <int> idg = id;
    for (int i = 0; i < q; ++i) {
        if (s[i] == '>') idl[i] = -Inf;
        else idg[i] = -Inf;
    }
    SegmentTree stl(idl), stg(idg);

    vector <int> y = x;
    sort(y.begin(), y.end());
    vector <int> wh(n);
    vector <int> b = a;
    for (int i = 0; i < n; ++i) {
        int l = min(-a[i], a[i]);
        int r = max(-a[i], a[i]);
        int l2 = upper_bound(y.begin(), y.end(), l) - y.begin();
        int r2 = upper_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int l1 = lower_bound(y.begin(), y.end(), l) - y.begin();
        int r1 = lower_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int v1 = -Inf;
        int v2 = -Inf;
        if (r1 >= l1 && l1 != n - 1) v1 = stl.get(l1, r1);
        if (r2 >= l2 && l2 != n - 1) v2 = stg.get(l2, r2);
        if (v1 == -Inf && v2 == -Inf) wh[i] = -1;
        else {
            if (v1 > v2) {
                b[i] = abs(a[i]);
                wh[i] = v1;
            }
            else {
                b[i] = -abs(a[i]);
                wh[i] = v2;
            }
        }
    }
    /*for (int i = 0; i < n; ++i) a[i] = abs(a[i]);
    fenwick f(q);
    vector <int> kek_id(n);
    iota(kek_id.begin(), kek_id.end(), 0);
    sort(kek_id.begin(), kek_id.end(), [&] (int i, int j) {
        return a[i] < a[j];
    });
    reverse(kek_id.begin(), kek_id.end());

    int uk = 0;
    for (int i : kek_id) {
        while (uk < id.size() && x[id[uk]] < -a[i]) {
            if (s[id[uk]] == '>') {
                f.modify(id[uk], 1);
            }
            ++uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }
    uk = q - 1;
    f.clear();
    for (int i : kek_id) {
        while (uk >= 0 && x[id[uk]] > a[i]) {
            if (s[id[uk]] == '<') {
                f.modify(id[uk], 1);
            }
            --uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }*/
    for (int i = 0; i < n; ++i) {
        for (int j = wh[i] + 1; j < q; ++j) {
            if (s[j] == '>' && x[j] < -a[i]) b[i] *= -1;
            if (s[j] == '<' && x[j] > a[i]) b[i] *= -1;
        }
    }
    for (int i = 0; i < n; ++i) {
        cout << b[i] << ' ';
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;

struct SegmentTree {
    int n;
    vector <int> t;

    void build(const vector <int> &a) {
        for (int i = 0; i < n; ++i) {
            t[n + i] = a[i];
        }
        for (int i = n - 1; i > 0; --i) {
            t[i] = max(t[i << 1], t[i << 1 | 1]);
        }
    }

    void modify(int x, int val) {
        for (t[x += n] = val; x > 1; x >>= 1) {
            t[x >> 1] = max(t[x], t[x ^ 1]);
        }
    }

    int get(int l, int r) {
        ++r;
        int res = -Inf;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (r & 1) res = max(res, t[--r]);
        }
        return res;
    }

    SegmentTree(const vector <int> &a) {
        n = a.size();
        t.resize(2 * n, -Inf);
        build(a);
    }
};

struct fenwick {
    vector <int> f;
    int n;
    fenwick(int nn) {
        n = nn;
        f.resize(n);
    }
    void modify(int i, int val) {
        for (; i < n; i |= i + 1) f[i] += val;
    }
    int get(int i) {
        int res = 0;
        for (; i >= 0; i &= i + 1, --i) res += f[i];
        return res;
    }
    int sum(int l, int r) {
        if (l > r) return 0;
        return get(r) - get(l - 1);
    }
    void clear() {
        for (int i = 0; i < n; ++i) f[i] = 0;
    }
};

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n, q;
    cin >> n >> q;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector <char> s(q);
    vector <int> x(q);
    for (int i = 0; i < q; ++i) {
        cin >> s[i] >> x[i];
    }
    vector <int> id(q);
    iota(id.begin(), id.end(), 0);
    sort(id.begin(), id.end(), [&] (int i, int j) {
        return x[i] < x[j];
    });

    vector <int> idl = id;
    vector <int> idg = id;
    for (int i = 0; i < q; ++i) {
        if (s[i] == '>') idl[i] = -Inf;
        else idg[i] = -Inf;
    }
    SegmentTree stl(idl), stg(idg);

    vector <int> y = x;
    sort(y.begin(), y.end());
    vector <int> wh(n);
    vector <int> b = a;
    for (int i = 0; i < n; ++i) {
        int l = min(-a[i], a[i]);
        int r = max(-a[i], a[i]);
        int l1 = upper_bound(y.begin(), y.end(), l) - y.begin();
        int r1 = upper_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int l2 = lower_bound(y.begin(), y.end(), l) - y.begin();
        int r2 = lower_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int v1 = -Inf;
        int v2 = -Inf;
        if (r1 >= l1 && l1 != n - 1) v1 = stl.get(l1, r1);
        if (r2 >= l2 && l2 != n - 1) v2 = stg.get(l2, r2);
        if (v1 == -Inf && v2 == -Inf) wh[i] = -1;
        else {
            if (v1 > v2) {
                b[i] = abs(a[i]);
                wh[i] = v1;
            }
            else {
                b[i] = -abs(a[i]);
                wh[i] = v2;
            }
        }
    }
    /*for (int i = 0; i < n; ++i) a[i] = abs(a[i]);
    fenwick f(q);
    vector <int> kek_id(n);
    iota(kek_id.begin(), kek_id.end(), 0);
    sort(kek_id.begin(), kek_id.end(), [&] (int i, int j) {
        return a[i] < a[j];
    });
    reverse(kek_id.begin(), kek_id.end());

    int uk = 0;
    for (int i : kek_id) {
        while (uk < id.size() && x[id[uk]] < -a[i]) {
            if (s[id[uk]] == '>') {
                f.modify(id[uk], 1);
            }
            ++uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }
    uk = q - 1;
    f.clear();
    for (int i : kek_id) {
        while (uk >= 0 && x[id[uk]] > a[i]) {
            if (s[id[uk]] == '<') {
                f.modify(id[uk], 1);
            }
            --uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }*/
    for (int i = 0; i < n; ++i) {
        for (int j = wh[i] + 1; j < q; ++j) {
            if (s[j] == '<' && x[j] < -a[i]) b[i] *= -1;
            if (s[j] == '>' && x[j] > a[i]) b[i] *= -1;
        }
    }
    for (int i = 0; i < n; ++i) {
        cout << b[i] << ' ';
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;

struct SegmentTree {
    int n;
    vector <int> t;

    void build(const vector <int> &a) {
        for (int i = 0; i < n; ++i) {
            t[n + i] = a[i];
        }
        for (int i = n - 1; i > 0; --i) {
            t[i] = max(t[i << 1], t[i << 1 | 1]);
        }
    }

    void modify(int x, int val) {
        for (t[x += n] = val; x > 1; x >>= 1) {
            t[x >> 1] = max(t[x], t[x ^ 1]);
        }
    }

    int get(int l, int r) {
        ++r;
        int res = -Inf;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (r & 1) res = max(res, t[--r]);
        }
        return res;
    }

    SegmentTree(const vector <int> &a) {
        n = a.size();
        t.resize(2 * n, -Inf);
        build(a);
    }
};

struct fenwick {
    vector <int> f;
    int n;
    fenwick(int nn) {
        n = nn;
        f.resize(n);
    }
    void modify(int i, int val) {
        for (; i < n; i |= i + 1) f[i] += val;
    }
    int get(int i) {
        int res = 0;
        for (; i >= 0; i &= i + 1, --i) res += f[i];
        return res;
    }
    int sum(int l, int r) {
        if (l > r) return 0;
        return get(r) - get(l - 1);
    }
    void clear() {
        for (int i = 0; i < n; ++i) f[i] = 0;
    }
};

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n, q;
    cin >> n >> q;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector <char> s(q);
    vector <int> x(q);
    for (int i = 0; i < q; ++i) {
        cin >> s[i] >> x[i];
    }
    vector <int> id(q);
    iota(id.begin(), id.end(), 0);
    sort(id.begin(), id.end(), [&] (int i, int j) {
        return x[i] < x[j];
    });

    vector <int> idl = id;
    vector <int> idg = id;
    for (int i = 0; i < q; ++i) {
        if (s[i] == '>') idl[i] = -Inf;
        else idg[i] = -Inf;
    }
    SegmentTree stl(idl), stg(idg);

    vector <int> y = x;
    sort(y.begin(), y.end());
    vector <int> wh(n);
    vector <int> b = a;
    for (int i = 0; i < n; ++i) {
        int l = min(-a[i], a[i]);
        int r = max(-a[i], a[i]);
        int l1 = upper_bound(y.begin(), y.end(), l) - y.begin();
        int r1 = upper_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int l2 = lower_bound(y.begin(), y.end(), l) - y.begin();
        int r2 = lower_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int v1 = -Inf;
        int v2 = -Inf;
        if (r1 >= l1 && l1 != n - 1) v1 = stl.get(l1, r1);
        if (r2 >= l2 && l2 != n - 1) v2 = stg.get(l2, r2);
        if (v1 == -Inf && v2 == -Inf) wh[i] = -1;
        else {
            if (v1 > v2) {
                b[i] = abs(a[i]);
                wh[i] = v1;
            }
            else {
                b[i] = -abs(a[i]);
                wh[i] = v2;
            }
        }
    }
    /*for (int i = 0; i < n; ++i) a[i] = abs(a[i]);
    fenwick f(q);
    vector <int> kek_id(n);
    iota(kek_id.begin(), kek_id.end(), 0);
    sort(kek_id.begin(), kek_id.end(), [&] (int i, int j) {
        return a[i] < a[j];
    });
    reverse(kek_id.begin(), kek_id.end());

    int uk = 0;
    for (int i : kek_id) {
        while (uk < id.size() && x[id[uk]] < -a[i]) {
            if (s[id[uk]] == '>') {
                f.modify(id[uk], 1);
            }
            ++uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }
    uk = q - 1;
    f.clear();
    for (int i : kek_id) {
        while (uk >= 0 && x[id[uk]] > a[i]) {
            if (s[id[uk]] == '<') {
                f.modify(id[uk], 1);
            }
            --uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }*/
    for (int i = 0; i < n; ++i) {
        for (int j = wh[i] + 1; j < q; ++j) {
            if (s[j] == '>' && x[j] < -a[i]) b[i] *= -1;
            if (s[j] == '<' && x[j] > a[i]) b[i] *= -1;
        }
    }
    for (int i = 0; i < n; ++i) {
        cout << b[i] << ' ';
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;

struct SegmentTree {
    int n;
    vector <int> t;

    void build(const vector <int> &a) {
        for (int i = 0; i < n; ++i) {
            t[n + i] = a[i];
        }
        for (int i = n - 1; i > 0; --i) {
            t[i] = max(t[i << 1], t[i << 1 | 1]);
        }
    }

    void modify(int x, int val) {
        for (t[x += n] = val; x > 1; x >>= 1) {
            t[x >> 1] = max(t[x], t[x ^ 1]);
        }
    }

    int get(int l, int r) {
        ++r;
        int res = -Inf;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (r & 1) res = max(res, t[--r]);
        }
        return res;
    }

    SegmentTree(const vector <int> &a) {
        n = a.size();
        t.resize(2 * n, -Inf);
        build(a);
    }
};

struct fenwick {
    vector <int> f;
    int n;
    fenwick(int nn) {
        n = nn;
        f.resize(n);
    }
    void modify(int i, int val) {
        for (; i < n; i |= i + 1) f[i] += val;
    }
    int get(int i) {
        int res = 0;
        for (; i >= 0; i &= i + 1, --i) res += f[i];
        return res;
    }
    int sum(int l, int r) {
        if (l > r) return 0;
        return get(r) - get(l - 1);
    }
    void clear() {
        for (int i = 0; i < n; ++i) f[i] = 0;
    }
};

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n, q;
    cin >> n >> q;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector <char> s(q);
    vector <int> x(q);
    for (int i = 0; i < q; ++i) {
        cin >> s[i] >> x[i];
    }
    vector <int> id(q);
    iota(id.begin(), id.end(), 0);
    sort(id.begin(), id.end(), [&] (int i, int j) {
        return x[i] < x[j];
    });

    vector <int> idl = id;
    vector <int> idg = id;
    for (int i = 0; i < q; ++i) {
        if (s[i] == '>') idl[i] = -Inf;
        else idg[i] = -Inf;
    }
    SegmentTree stl(idl), stg(idg);

    vector <int> y = x;
    sort(y.begin(), y.end());
    vector <int> wh(n);
    vector <int> b = a;
    for (int i = 0; i < n; ++i) {
        int l = min(-a[i], a[i]);
        int r = max(-a[i], a[i]);
        int l1 = upper_bound(y.begin(), y.end(), l) - y.begin();
        int r2 = upper_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int l2 = lower_bound(y.begin(), y.end(), l) - y.begin();
        int r1 = lower_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int v1 = -Inf;
        int v2 = -Inf;
        if (r1 >= l1 && l1 != n - 1) v1 = stl.get(l1, r1);
        if (r2 >= l2 && l2 != n - 1) v2 = stg.get(l2, r2);
        if (v1 == -Inf && v2 == -Inf) wh[i] = -1;
        else {
            if (v1 > v2) {
                b[i] = abs(a[i]);
                wh[i] = v1;
            }
            else {
                b[i] = -abs(a[i]);
                wh[i] = v2;
            }
        }
    }
    /*for (int i = 0; i < n; ++i) a[i] = abs(a[i]);
    fenwick f(q);
    vector <int> kek_id(n);
    iota(kek_id.begin(), kek_id.end(), 0);
    sort(kek_id.begin(), kek_id.end(), [&] (int i, int j) {
        return a[i] < a[j];
    });
    reverse(kek_id.begin(), kek_id.end());

    int uk = 0;
    for (int i : kek_id) {
        while (uk < id.size() && x[id[uk]] < -a[i]) {
            if (s[id[uk]] == '>') {
                f.modify(id[uk], 1);
            }
            ++uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }
    uk = q - 1;
    f.clear();
    for (int i : kek_id) {
        while (uk >= 0 && x[id[uk]] > a[i]) {
            if (s[id[uk]] == '<') {
                f.modify(id[uk], 1);
            }
            --uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }*/
    for (int i = 0; i < n; ++i) {
        for (int j = wh[i] + 1; j < q; ++j) {
            if (s[j] == '>' && x[j] < -a[i]) b[i] *= -1;
            if (s[j] == '<' && x[j] > a[i]) b[i] *= -1;
        }
    }
    for (int i = 0; i < n; ++i) {
        cout << b[i] << ' ';
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;

struct SegmentTree {
    int n;
    vector <int> t;

    void build(const vector <int> &a) {
        for (int i = 0; i < n; ++i) {
            t[n + i] = a[i];
        }
        for (int i = n - 1; i > 0; --i) {
            t[i] = max(t[i << 1], t[i << 1 | 1]);
        }
    }

    void modify(int x, int val) {
        for (t[x += n] = val; x > 1; x >>= 1) {
            t[x >> 1] = max(t[x], t[x ^ 1]);
        }
    }

    int get(int l, int r) {
        ++r;
        int res = -Inf;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (r & 1) res = max(res, t[--r]);
        }
        return res;
    }

    SegmentTree(const vector <int> &a) {
        n = a.size();
        t.resize(2 * n, -Inf);
        build(a);
    }
};

struct fenwick {
    vector <int> f;
    int n;
    fenwick(int nn) {
        n = nn;
        f.resize(n);
    }
    void modify(int i, int val) {
        for (; i < n; i |= i + 1) f[i] += val;
    }
    int get(int i) {
        int res = 0;
        for (; i >= 0; i &= i + 1, --i) res += f[i];
        return res;
    }
    int sum(int l, int r) {
        if (l > r) return 0;
        return get(r) - get(l - 1);
    }
    void clear() {
        for (int i = 0; i < n; ++i) f[i] = 0;
    }
};

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n, q;
    cin >> n >> q;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector <char> s(q);
    vector <int> x(q);
    for (int i = 0; i < q; ++i) {
        cin >> s[i] >> x[i];
    }
    vector <int> id(q);
    iota(id.begin(), id.end(), 0);
    sort(id.begin(), id.end(), [&] (int i, int j) {
        return x[i] < x[j];
    });

    vector <int> idl = id;
    vector <int> idg = id;
    for (int i = 0; i < q; ++i) {
        if (s[id[i]] == '>') idl[i] = -Inf;
        else idg[i] = -Inf;
    }

    SegmentTree stl(idl), stg(idg);

    vector <int> y = x;
    sort(y.begin(), y.end());
    vector <int> wh(n);
    vector <int> b = a;
    for (int i = 0; i < n; ++i) {
        int l = min(-a[i], a[i]);
        int r = max(-a[i], a[i]);
        int l1 = upper_bound(y.begin(), y.end(), l) - y.begin();
        int r1 = upper_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int l2 = lower_bound(y.begin(), y.end(), l) - y.begin();
        int r2 = lower_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int v1 = -Inf;
        int v2 = -Inf;
        if (r1 >= l1 && l1 != n - 1) v1 = stl.get(l1, r1);
        if (r2 >= l2 && l2 != n - 1) v2 = stg.get(l2, r2);
        if (v1 == -Inf && v2 == -Inf) wh[i] = -1;
        else {
            if (v1 > v2) {
                b[i] = abs(a[i]);
                wh[i] = v1;
            }
            else {
                b[i] = -abs(a[i]);
                wh[i] = v2;
            }
        }
    }
    for (int i = 0; i < n; ++i) a[i] = abs(a[i]);
    fenwick f(q);
    vector <int> kek_id(n);
    iota(kek_id.begin(), kek_id.end(), 0);
    sort(kek_id.begin(), kek_id.end(), [&] (int i, int j) {
        return a[i] < a[j];
    });
    int uk = 0;
    for (int i : kek_id) {
        while (uk < id.size() && x[id[uk]] < -a[i]) {
            if (s[id[uk]] == '>') {
                f.modify(id[uk], 1);
            }
            ++uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }
    reverse(kek_id.begin(), kek_id.end());
    uk = q - 1;
    f.clear();
    for (int i : kek_id) {
        while (uk >= 0 && x[id[uk]] > a[i]) {
            if (s[id[uk]] == '<') {
                f.modify(id[uk], 1);
            }
            --uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }
    for (int i = 0; i < n; ++i) {
        cout << b[i] << ' ';
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;

struct SegmentTree {
    int n;
    vector <int> t;

    void build(const vector <int> &a) {
        for (int i = 0; i < n; ++i) {
            t[n + i] = a[i];
        }
        for (int i = n - 1; i > 0; --i) {
            t[i] = max(t[i << 1], t[i << 1 | 1]);
        }
    }

    void modify(int x, int val) {
        for (t[x += n] = val; x > 1; x >>= 1) {
            t[x >> 1] = max(t[x], t[x ^ 1]);
        }
    }

    int get(int l, int r) {
        ++r;
        int res = -Inf;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (r & 1) res = max(res, t[--r]);
        }
        return res;
    }

    SegmentTree(const vector <int> &a) {
        n = a.size();
        t.resize(2 * n, -Inf);
        build(a);
    }
};

struct fenwick {
    vector <int> f;
    int n;
    fenwick(int nn) {
        n = nn;
        f.resize(n);
    }
    void modify(int i, int val) {
        for (; i < n; i |= i + 1) f[i] += val;
    }
    int get(int i) {
        int res = 0;
        for (; i >= 0; i &= i + 1, --i) res += f[i];
        return res;
    }
    int sum(int l, int r) {
        if (l > r) return 0;
        return get(r) - get(l - 1);
    }
    void clear() {
        for (int i = 0; i < n; ++i) f[i] = 0;
    }
};

const int N = 1e5 + 7;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n, q;
    cin >> n >> q;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector <char> s(q);
    vector <int> x(q);
    for (int i = 0; i < q; ++i) {
        cin >> s[i] >> x[i];
    }
    vector <int> id(q);
    iota(id.begin(), id.end(), 0);
    sort(id.begin(), id.end(), [&] (int i, int j) {
        return x[i] < x[j];
    });

    vector <int> idl = id;
    vector <int> idg = id;
    for (int i = 0; i < q; ++i) {
        if (s[i] == '>') idl[i] = -Inf;
        else idg[i] = -Inf;
    }
    SegmentTree stl(idl), stg(idg);

    vector <int> y = x;
    sort(y.begin(), y.end());
    vector <int> wh(n);
    vector <int> b = a;
    for (int i = 0; i < n; ++i) {
        int l = min(-a[i], a[i]);
        int r = max(-a[i], a[i]);
        int l1 = upper_bound(y.begin(), y.end(), l) - y.begin();
        int r1 = upper_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int l2 = lower_bound(y.begin(), y.end(), l) - y.begin();
        int r2 = lower_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int v1 = -Inf;
        int v2 = -Inf;
        if (r1 >= l1 && l1 != n - 1) v1 = stl.get(l1, r1);
        if (r2 >= l2 && l2 != n - 1) v2 = stg.get(l2, r2);
        if (v1 == -Inf && v2 == -Inf) wh[i] = -1;
        else {
            if (v1 > v2) {
                b[i] = abs(a[i]);
                wh[i] = v1;
            }
            else {
                b[i] = -abs(a[i]);
                wh[i] = v2;
            }
        }
    }
    for (int i = 0; i < n; ++i) a[i] = abs(a[i]);
    fenwick f(q);
    vector <int> kek_id(n);
    iota(kek_id.begin(), kek_id.end(), 0);
    sort(kek_id.begin(), kek_id.end(), [&] (int i, int j) {
        return a[i] < a[j];
    });
    reverse(kek_id.begin(), kek_id.end());

    int uk = 0;
    for (int i : kek_id) {
        while (uk < id.size() && x[id[uk]] < -a[i]) {
            if (s[id[uk]] == '>') {
                f.modify(id[uk], 1);
            }
            ++uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }
    uk = q - 1;
    f.clear();
    for (int i : kek_id) {
        while (uk >= 0 && x[id[uk]] > a[i]) {
            if (s[id[uk]] == '<') {
                f.modify(id[uk], 1);
            }
            --uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }
    for (int i = 0; i < n; ++i) {
        cout << b[i] << ' ';
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;

struct SegmentTree {
    int n;
    vector <int> t;

    void build(const vector <int> &a) {
        for (int i = 0; i < n; ++i) {
            t[n + i] = a[i];
        }
        for (int i = n - 1; i > 0; --i) {
            t[i] = max(t[i << 1], t[i << 1 | 1]);
        }
    }

    void modify(int x, int val) {
        for (t[x += n] = val; x > 1; x >>= 1) {
            t[x >> 1] = max(t[x], t[x ^ 1]);
        }
    }

    int get(int l, int r) {
        ++r;
        int res = -Inf;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (r & 1) res = max(res, t[--r]);
        }
        return res;
    }

    SegmentTree(const vector <int> &a) {
        n = a.size();
        t.resize(2 * n, -Inf);
        build(a);
    }
};

struct fenwick {
    vector <int> f;
    int n;
    fenwick(int nn) {
        n = nn;
        f.resize(n);
    }
    void modify(int i, int val) {
        for (; i < n; i |= i + 1) f[i] += val;
    }
    int get(int i) {
        int res = 0;
        for (; i >= 0; i &= i + 1, --i) res += f[i];
        return res;
    }
    int sum(int l, int r) {
        if (l > r) return 0;
        return get(r) - get(l - 1);
    }
    void clear() {
        for (int i = 0; i < n; ++i) f[i] = 0;
    }
};

const int N = 1e5 + 7;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n, q;
    cin >> n >> q;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector <char> s(q);
    vector <int> x(q);
    for (int i = 0; i < q; ++i) {
        cin >> s[i] >> x[i];
    }
    vector <int> id(q);
    iota(id.begin(), id.end(), 0);
    sort(id.begin(), id.end(), [&] (int i, int j) {
        return x[i] < x[j];
    });

    vector <int> idl = id;
    vector <int> idg = id;
    for (int i = 0; i < q; ++i) {
        if (s[i] == '>') idl[i] = -Inf;
        else idg[i] = -Inf;
    }
    SegmentTree stl(idl), stg(idg);

    vector <int> y = x;
    sort(y.begin(), y.end());
    vector <int> wh(n);
    vector <int> b = a;
    for (int i = 0; i < n; ++i) {
        int l = min(-a[i], a[i]);
        int r = max(-a[i], a[i]);
        int l1 = upper_bound(y.begin(), y.end(), l) - y.begin();
        int r1 = upper_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int l2 = lower_bound(y.begin(), y.end(), l) - y.begin();
        int r2 = lower_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int v1 = -Inf;
        int v2 = -Inf;
        if (r1 >= l1 && l1 != n - 1) v1 = stl.get(l1, r1);
        if (r2 >= l2 && l2 != n - 1) v2 = stg.get(l2, r2);
        if (v1 == -Inf && v2 == -Inf) wh[i] = -1;
        else {
            if (v1 > v2) {
                b[i] = abs(a[i]);
                wh[i] = v1;
            }
            else {
                b[i] = -abs(a[i]);
                wh[i] = v2;
            }
        }
    }
    for (int i = 0; i < n; ++i) a[i] = abs(a[i]);
    fenwick f(q);
    vector <int> kek_id(n);
    iota(kek_id.begin(), kek_id.end(), 0);
    sort(kek_id.begin(), kek_id.end(), [&] (int i, int j) {
        return a[i] < a[j];
    });
    int uk = 0;
    for (int i : kek_id) {
        while (uk < id.size() && x[id[uk]] < -a[i]) {
            if (s[id[uk]] == '>') {
                f.modify(id[uk], 1);
            }
            ++uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }
    reverse(kek_id.begin(), kek_id.end());
    uk = q - 1;
    f.clear();
    for (int i : kek_id) {
        while (uk >= 0 && x[id[uk]] > a[i]) {
            if (s[id[uk]] == '<') {
                f.modify(id[uk], 1);
            }
            --uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }
    for (int i = 0; i < n; ++i) {
        cout << b[i] << ' ';
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;

struct SegmentTree {
    int n;
    vector <int> t;

    void build(const vector <int> &a) {
        for (int i = 0; i < n; ++i) {
            t[n + i] = a[i];
        }
        for (int i = n - 1; i > 0; --i) {
            t[i] = max(t[i << 1], t[i << 1 | 1]);
        }
    }

    void modify(int x, int val) {
        for (t[x += n] = val; x > 1; x >>= 1) {
            t[x >> 1] = max(t[x], t[x ^ 1]);
        }
    }

    int get(int l, int r) {
        ++r;
        int res = -Inf;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (r & 1) res = max(res, t[--r]);
        }
        return res;
    }

    SegmentTree(const vector <int> &a) {
        n = a.size();
        t.resize(2 * n, -Inf);
        build(a);
    }
};

struct fenwick {
    vector <int> f;
    int n;
    fenwick(int nn) {
        n = nn;
        f.resize(n);
    }
    void modify(int i, int val) {
        for (; i < n; i |= i + 1) f[i] += val;
    }
    int get(int i) {
        int res = 0;
        for (; i >= 0; i &= i + 1, --i) res += f[i];
        return res;
    }
    int sum(int l, int r) {
        if (l > r) return 0;
        return get(r) - get(l - 1);
    }
    void clear() {
        for (int i = 0; i < n; ++i) f[i] = 0;
    }
};

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n, q;
    cin >> n >> q;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector <char> s(q);
    vector <int> x(q);
    for (int i = 0; i < q; ++i) {
        cin >> s[i] >> x[i];
    }
    vector <int> id(q);
    iota(id.begin(), id.end(), 0);
    sort(id.begin(), id.end(), [&] (int i, int j) {
        return x[i] < x[j];
    });

    vector <int> idl = id;
    vector <int> idg = id;
    for (int i = 0; i < q; ++i) {
        if (s[i] == '>') idl[i] = -Inf;
        else idg[i] = -Inf;
    }
    SegmentTree stl(idl), stg(idg);

    vector <int> y = x;
    sort(y.begin(), y.end());
    vector <int> wh(n);
    vector <int> b = a;
    for (int i = 0; i < n; ++i) {
        int l = min(-a[i], a[i]);
        int r = max(-a[i], a[i]);
        int l1 = upper_bound(y.begin(), y.end(), l) - y.begin();
        int r2 = upper_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int l1 = lower_bound(y.begin(), y.end(), l) - y.begin();
        int r1 = lower_bound(y.begin(), y.end(), r) - y.begin() - 1;
        int v1 = -Inf;
        int v2 = -Inf;
        if (r1 >= l1 && l1 != n - 1) v1 = stl.get(l1, r1);
        if (r2 >= l2 && l2 != n - 1) v2 = stg.get(l2, r2);
        if (v1 == -Inf && v2 == -Inf) wh[i] = -1;
        else {
            if (v1 > v2) {
                b[i] = abs(a[i]);
                wh[i] = v1;
            }
            else {
                b[i] = -abs(a[i]);
                wh[i] = v2;
            }
        }
    }
    /*for (int i = 0; i < n; ++i) a[i] = abs(a[i]);
    fenwick f(q);
    vector <int> kek_id(n);
    iota(kek_id.begin(), kek_id.end(), 0);
    sort(kek_id.begin(), kek_id.end(), [&] (int i, int j) {
        return a[i] < a[j];
    });
    reverse(kek_id.begin(), kek_id.end());

    int uk = 0;
    for (int i : kek_id) {
        while (uk < id.size() && x[id[uk]] < -a[i]) {
            if (s[id[uk]] == '>') {
                f.modify(id[uk], 1);
            }
            ++uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }
    uk = q - 1;
    f.clear();
    for (int i : kek_id) {
        while (uk >= 0 && x[id[uk]] > a[i]) {
            if (s[id[uk]] == '<') {
                f.modify(id[uk], 1);
            }
            --uk;
        }
        if (f.sum(wh[i] + 1, q - 1) % 2 == 1) {
            b[i] *= -1;
        }
    }*/
    for (int i = 0; i < n; ++i) {
        for (int j = wh[i] + 1; j < q; ++j) {
            if (s[j] == '>' && x[j] < -a[i]) b[i] *= -1;
            if (s[j] == '<' && x[j] > a[i]) b[i] *= -1;
        }
    }
    for (int i = 0; i < n; ++i) {
        cout << b[i] << ' ';
    }
}