#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1 << 18, OFF = 1e5 + 10;
int neg(int x) { return OFF - (x - OFF); }
char segt[2 * N], lazy[2 * N];
void push(int i) {
  if (lazy[i]) {
    segt[2 * i] ^= 1;
    segt[2 * i + 1] ^= 1;
    lazy[2 * i] ^= 1;
    lazy[2 * i + 1] ^= 1;
    lazy[i] = 0;
  }
}
void pull(int i) {
  if (segt[2 * i] != segt[2 * i + 1]) {
    segt[i] = 2;
  } else
    segt[i] = segt[2 * i];
}
void update(int x, int y, int i = 1, int l = 0, int r = N - 1) {
  if (segt[i] == 0 && (y < l || r < x)) return;
  if (segt[i] == 1 && (y < neg(r) || neg(l) < x)) return;
  if (segt[i] == 0 && x <= l && r <= y) {
    segt[i] ^= 1;
    lazy[i] ^= 1;
    return;
  }
  if (segt[i] == 1 && x <= neg(r) && neg(l) <= y) {
    segt[i] ^= 1;
    lazy[i] ^= 1;
    return;
  }
  push(i);
  int m = (l + r) / 2;
  update(x, y, 2 * i, l, m);
  update(x, y, 2 * i + 1, m + 1, r);
  pull(i);
}
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 : a) cin >> i;
  for (int i = 0; i < q; i++) {
    char s;
    int x;
    cin >> s >> x;
    if (s == '<') {
      update(0, OFF + x - 1);
    } else {
      update(OFF + x + 1, N - 1);
    }
  }
  for (int i = 1; i < N; i++) {
    push(i);
  }
  for (int i : a) {
    if (segt[N + OFF + i])
      cout << -i << " ";
    else
      cout << i << " ";
  }
  cout << nl;
  return 0;
}
