#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int n, m, k;
int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * f;
}
inline void print(int *f, int len) {
  for (int i = 0; i < len; i++) printf("%lld ", f[i]);
  puts("");
}
const int maxn = 1e5 + 10, N = 1e5;
char b1[maxn], b2[maxn];
int a[maxn];
signed main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  int q;
  cin >> q;
  for (int i = 1, iend = n; i <= iend; ++i) cin >> a[i];
  while (q--) {
    char ch;
    cin >> ch;
    int x;
    cin >> x;
    int u = x;
    if (u < 0) u = -u;
    if (ch == '>') {
      if (x > 0) {
        for (int i = x + 1, iend = N; i <= iend; ++i) b1[i] = 1, b2[i] = 0;
      } else {
        for (int i = 0, iend = u - 1; i <= iend; ++i) b1[i] ^= 1, b2[i] ^= 1;
        for (int i = u, iend = N; i <= iend; ++i) b1[i] = 1, b2[i] = 0;
      }
    } else {
      if (x < 0) {
        for (int i = u + 1, iend = N; i <= iend; ++i) b1[i] = 0, b2[i] = 1;
      } else {
        for (int i = 0, iend = x - 1; i <= iend; ++i) b1[i] ^= 1, b2[i] ^= 1;
        for (int i = x, iend = N; i <= iend; ++i) b1[i] = 0, b2[i] = 1;
      }
    }
  }
  for (int i = 1, iend = n; i <= iend; ++i) {
    if ((a[i] > 0 && b1[a[i]] == 1) || (a[i] < 0 && b2[-a[i]] == 1)) {
      a[i] = -a[i];
    }
    cout << a[i] << " ";
  }
}
