#include <bits/stdc++.h>
using namespace std;
const int shift = 1e5;
const int N = 2 * shift + 50;
int T[4 * N] = {0};
int rev[4 * N];
void push(int v) {
  if (T[v] != -1) {
    T[v << 1 | 1] = T[v];
    T[v << 1] = T[v];
    T[v] = -1;
    rev[v << 1 | 1] = rev[v << 1] = rev[v] = 0;
  } else {
    rev[v << 1] ^= rev[v];
    rev[v << 1 | 1] ^= rev[v];
    rev[v] = 0;
    if (T[v << 1] != -1 && rev[v << 1]) {
      T[v << 1] = 1 - T[v << 1];
      rev[v << 1] = 0;
    }
    if (T[v << 1 | 1] != -1 && rev[v << 1 | 1]) {
      T[v << 1 | 1] = 1 - T[v << 1 | 1];
      rev[v << 1 | 1] = 0;
    }
  }
}
void updr(int v, int tl, int tr, int l, int r) {
  if (l > r) return;
  if (tl == l && tr == r) {
    if (T[v] == -1) {
      rev[v] = 1 - rev[v];
    } else {
      T[v] = 1 - T[v];
      rev[v] = 0;
    }
    return;
  }
  int mid = (tl + tr) >> 1;
  push(v);
  if (l <= mid) updr(v << 1, tl, mid, l, min(r, mid));
  if (r > mid) updr(v << 1 | 1, mid + 1, tr, max(l, mid + 1), r);
}
void upd(int v, int tl, int tr, int l, int r, int val) {
  if (l > r) return;
  if (tl == l && tr == r) {
    T[v] = val;
    rev[v] = 0;
    return;
  }
  int mid = (tl + tr) >> 1;
  push(v);
  if (l <= mid) upd(v << 1, tl, mid, l, min(r, mid), val);
  if (r > mid) upd(v << 1 | 1, mid + 1, tr, max(l, mid + 1), r, val);
}
int get(int v, int tl, int tr, int pos) {
  if (tl == tr) {
    return T[v];
  }
  push(v);
  int mid = (tl + tr) >> 1;
  if (pos <= mid)
    return get(v << 1, tl, mid, pos);
  else {
    return get(v << 1 | 1, mid + 1, tr, pos);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  while (q--) {
    char c;
    int x;
    cin >> c >> x;
    if (c == '<') {
      if (x > 0) {
        updr(1, 0, N - 1, -x + 1 + shift, x - 1 + shift);
        upd(1, 0, N - 1, 0, -x + shift, 1);
        upd(1, 0, N - 1, x + shift, N - 1, 0);
      } else {
        upd(1, 0, N - 1, 0, x - 1 + shift, 1);
        upd(1, 0, N - 1, -x + 1 + shift, N - 1, 0);
      }
    } else {
      if (x >= 0) {
        upd(1, 0, N - 1, x + 1 + shift, N - 1, 1);
        upd(1, 0, N - 1, 0, -x - 1 + shift, 0);
      } else {
        upd(1, 0, N - 1, 0, x + shift, 0);
        updr(1, 0, N - 1, x + 1 + shift, -x - 1 + shift);
        upd(1, 0, N - 1, -x + shift, N - 1, 1);
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] * (-1 * (get(1, 0, N - 1, a[i] + shift) ? 1 : -1)) << ' ';
  }
}
