#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const long long INF = mod * mod;
const long double eps = 1e-8;
struct SegT {
 private:
  int sz;
  vector<pair<int, int>> node;
  const pair<int, int> init_c = {0, 1};

 public:
  SegT(int n) {
    sz = 1;
    while (sz < n) sz *= 2;
    node.resize(2 * sz - 1, init_c);
  }
  pair<int, int> f(pair<int, int> a, pair<int, int> b) {
    pair<int, int> ret;
    if (a.first == 0)
      ret.first = b.first;
    else
      ret.first = b.second;
    if (a.second == 0)
      ret.second = b.first;
    else
      ret.second = b.second;
    return ret;
  }
  void update(int k, pair<int, int> a) {
    k += sz - 1;
    node[k] = a;
    while (k > 0) {
      k = (k - 1) / 2;
      node[k] = f(node[k * 2 + 1], node[k * 2 + 2]);
    }
  }
  pair<int, int> query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = sz;
    if (r <= a || b <= l)
      return init_c;
    else if (a <= l && r <= b)
      return node[k];
    else {
      pair<int, int> vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
      pair<int, int> vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
      return f(vl, vr);
    }
  }
};
vector<int> pans(1 << 17), nans(1 << 17);
vector<pair<int, pair<char, int>>> loc[1 << 17];
void solve() {
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  SegT st(q);
  vector<pair<char, int>> s(q);
  for (int i = 0; i < q; i++) {
    cin >> s[i].first >> s[i].second;
    loc[abs(s[i].second)].push_back({i, s[i]});
    if (s[i].first == '<' && s[i].second >= 0) {
      st.update(i, {1, 0});
    }
    if (s[i].first == '>' && s[i].second <= 0) {
      st.update(i, {1, 0});
    }
  }
  for (int i = 0; i < 100001; i++) {
    for (int j = 0; j < loc[i].size(); j++) {
      int id = loc[i][j].first;
      char t = loc[i][j].second.first;
      int x = loc[i][j].second.second;
      if (t == '<' && x >= 0) {
        st.update(id, {1, 1});
      }
      if (t == '>' && x <= 0) {
        st.update(id, {0, 0});
      }
    }
    pair<int, int> v = st.query(0, q);
    if (v.first == 0)
      nans[i] = -i;
    else
      nans[i] = i;
    if (v.second == 0)
      pans[i] = -i;
    else
      pans[i] = i;
    for (int j = 0; j < loc[i].size(); j++) {
      int id = loc[i][j].first;
      char t = loc[i][j].second.first;
      int x = loc[i][j].second.second;
      if (t == '<' && x <= 0) {
        st.update(id, {1, 1});
      }
      if (t == '>' && x >= 0) {
        st.update(id, {0, 0});
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    if (a[i] >= 0) {
      cout << pans[a[i]];
    } else {
      cout << nans[-a[i]];
    }
  }
  cout << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}
