#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 233;
vector<int> q[maxn], p[maxn];
int ans[maxn], a[maxn], ch[maxn << 2][2], op[maxn], v[maxn];
void update(int l, int r, int cur, int x, int val) {
  if (l == r) {
    if (op[l] == 0) {
      if (-val < v[l])
        ch[cur][0] = 1;
      else
        ch[cur][0] = 0;
      if (val < v[l])
        ch[cur][1] = 0;
      else
        ch[cur][1] = 1;
    } else {
      if (-val > v[l])
        ch[cur][0] = 1;
      else
        ch[cur][0] = 0;
      if (val > v[l])
        ch[cur][1] = 0;
      else
        ch[cur][1] = 1;
    }
    return;
  }
  int mid = (l + r) >> 1, lc = cur << 1, rc = lc | 1;
  if (x <= mid)
    update(l, mid, lc, x, val);
  else
    update(mid + 1, r, rc, x, val);
  ch[cur][0] = ch[rc][ch[lc][0]];
  ch[cur][1] = ch[rc][ch[lc][1]];
}
int main() {
  int n, Q;
  cin >> n >> Q;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    p[abs(a[i])].push_back(i);
  }
  for (int i = 1; i <= Q; i++) {
    char c;
    scanf(" %c%d", &c, &v[i]);
    if (c == '<') {
      op[i] = 0;
      if (v[i] > 0)
        q[abs(v[i]) - 1].push_back(i);
      else
        q[abs(v[i])].push_back(i);
    } else {
      op[i] = 1;
      if (v[i] >= 0)
        q[abs(v[i])].push_back(i);
      else
        q[abs(v[i]) - 1].push_back(i);
    }
  }
  for (int i = 1; i <= Q; i++) update(1, Q, 1, i, 100001);
  for (int cur = 100000; cur >= 0; cur--) {
    for (int i = 0; i < q[cur].size(); i++) update(1, Q, 1, q[cur][i], cur);
    for (int i = 0; i < p[cur].size(); i++) {
      int x = p[cur][i];
      if (a[x] < 0)
        ans[x] = ch[1][0];
      else
        ans[x] = ch[1][1];
      if (ans[x] == 0)
        ans[x] = -cur;
      else
        ans[x] = cur;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
