#include <bits/stdc++.h>
using namespace std;
template <typename T>
using min_queue = priority_queue<T, vector<T>, greater<T>>;
const long long MOD = 1e9 + 7;
using node = int;
const int MAXN = 100100;
int N = MAXN;
int mp[MAXN];
node seg[4 * MAXN];
inline void push(int ix, bool nonleaf) {
  if (!nonleaf) return;
  if (seg[ix] == 0) return;
  if (seg[ix] & 2) {
    seg[ix * 2] = seg[ix * 2 + 1] = seg[ix];
  } else {
    seg[ix * 2] ^= seg[ix];
    seg[ix * 2 + 1] ^= seg[ix];
  }
  seg[ix] = 0;
}
void range_update(int a, int b, int v, int ix = 1, int l = 0, int r = N) {
  if (b <= l || a >= r) return;
  if (a <= l && r <= b) {
    if (v == 0) {
      seg[ix] ^= 1;
    } else if (v == 1) {
      seg[ix] = 2;
    } else if (v == -1) {
      seg[ix] = 3;
    }
    push(ix, r - l > 1);
    return;
  }
  push(ix, r - l > 1);
  range_update(a, b, v, 2 * ix, l, (l + r) / 2);
  range_update(a, b, v, 2 * ix + 1, (l + r) / 2, r);
}
void query(int ix = 1, int l = 0, int r = N) {
  if (r - l == 0) return;
  push(ix, r - l > 1);
  if (r - l == 1) {
    mp[l] = seg[ix];
    return;
  }
  query(2 * ix, l, (l + r) / 2);
  query(2 * ix + 1, (l + r) / 2, r);
}
int a[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int M, Q;
  cin >> M >> Q;
  for (int i = 0; i < M; i++) {
    cin >> a[i];
  }
  while (Q-- > 0) {
    char op;
    cin >> op;
    int k;
    cin >> k;
    if (op == '>') {
      if (k >= 0) {
        range_update(k + 1, N, -1);
      } else {
        range_update(0, -k + 1, 0);
        range_update(-k, N, -1);
      }
    } else {
      if (k <= 0) {
        range_update(1 - k, N, 1);
      } else {
        range_update(0, k, 0);
        range_update(k, N, 1);
      }
    }
  }
  query();
  for (int i = 0; i < M; i++) {
    int v = mp[abs(a[i])];
    if (v & 2) a[i] = abs(a[i]);
    if (v & 1) a[i] = -a[i];
    cout << a[i] << " \n"[i == M - 1];
  }
  return 0;
}
