#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<int> b = a;
  vector<int> s(m), x(m);
  for (int i = 0; i < m; ++i) {
    string t;
    cin >> t >> x[i];
    if (t == ">")
      s[i] = 1;
    else
      s[i] = -1;
  }
  const int N = 1e5 + 5;
  vector<int> mul(2 * N + 1, 1);
  int mi = N - 1;
  for (int i = m - 1; i >= 0; --i) {
    int l = -mi + 1, r = mi - 1;
    if (s[i] == -1) {
      r = min(r, x[i] - 1);
    } else {
      l = max(l, x[i] + 1);
    }
    mi = min(mi, abs(x[i]) + (s[i] * x[i] > 0));
    if (l <= r) {
      mul[N + l] *= -1;
      mul[N + r + 1] *= -1;
    }
  }
  vector<int> res(2 * N + 1, 1);
  for (int i = 1; i < (int)res.size(); ++i) {
    res[i] = res[i - 1] * mul[i];
  }
  for (int i = 0; i < (int)b.size(); ++i) {
    b[i] *= res[N + b[i]];
  }
  for (int i = 0; i < n; ++i) cout << b[i] << ' ';
  cout << endl;
  return 0;
}
