#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, q;
int a[maxn];
int x[maxn];
char s[maxn];
int ans[maxn];
vector<pair<int, int> > arr;
signed main() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    arr.push_back(pair<int, int>(abs(a[i]), i));
  }
  sort(arr.begin(), arr.end());
  for (int i = 0; i < q; i++) {
    cin >> s[i] >> x[i];
  }
  int tmp = 0;
  while (q--) {
    int l = abs(x[q]);
    if (s[q] == '>' && x[q] > 0) {
      l++;
    }
    if (s[q] == '<' && x[q] < 0) {
      l++;
    }
    while (arr.size()) {
      if (arr.back().first >= l) {
        if (s[q] == '>') {
          ans[arr.back().second] = -arr.back().first;
        } else {
          ans[arr.back().second] = arr.back().first;
        }
        if (tmp % 2 == 1) {
          ans[arr.back().second] = -ans[arr.back().second];
        }
        arr.pop_back();
      } else {
        break;
      }
    }
    if (s[q] == '>' && x[q] < 0) {
      tmp++;
    }
    if (s[q] == '<' && x[q] > 0) {
      tmp++;
    }
  }
  while (arr.size()) {
    if (tmp % 2 == 1) {
      ans[arr.back().second] = -a[arr.back().second];
    } else {
      ans[arr.back().second] = a[arr.back().second];
    }
    arr.pop_back();
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
}
