#include <bits/stdc++.h>
const int oo = 0x7fffffff;
const long long OO = 0x7fffffffffffffff;
template <class T>
std::ostream& operator<<(std::ostream& O, const std::vector<T>& V) {
  for (const T& x : V) O << x << " ";
  O << "\n";
  return O;
}
template <class T1, class T2>
std::ostream& operator<<(std::ostream& O, const std::pair<T1, T2>& P) {
  return O << "(" << P.first << ", " << P.second << ")";
}
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
using namespace std;
const int NX = 1 << 17;
int value[NX * 4];
int comb[4][4];
void rec_push(int a, int b, int l, int r, int i, int v) {
  if (a <= l and r <= b) {
    value[i] = comb[v][value[i]];
    return;
  }
  if (r < a or l > b) return;
  int m = (l + r) / 2;
  rec_push(l, r, l, m, i * 2, value[i]);
  rec_push(l, r, m + 1, r, i * 2 + 1, value[i]);
  value[i] = 0;
  rec_push(a, b, l, m, i * 2, v);
  rec_push(a, b, m + 1, r, i * 2 + 1, v);
}
int rec_query(int x, int l, int r, int i) {
  ;
  ;
  ;
  ;
  if (l == r) return value[i];
  int m = (l + r) / 2, v;
  if (x <= m)
    v = rec_query(x, l, m, i * 2);
  else
    v = rec_query(x, m + 1, r, i * 2 + 1);
  return comb[value[i]][v];
}
void push(int a, int b, int v) { rec_push(a, b, 0, NX - 1, 1, v); }
int query(int x) { return rec_query(x, 0, NX - 1, 1); }
void init() {
  comb[1][0] = 1;
  comb[2][0] = 2;
  comb[3][0] = 3;
  comb[0][0] = 0;
  comb[1][1] = 1;
  comb[2][1] = 2;
  comb[0][1] = 1;
  comb[3][1] = 2;
  comb[1][2] = 1;
  comb[2][2] = 2;
  comb[0][2] = 2;
  comb[3][2] = 1;
  comb[1][3] = 1;
  comb[2][3] = 2;
  comb[0][3] = 3;
  comb[3][3] = 0;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  ;
  init();
  int n, q;
  cin >> n >> q;
  vector<int> ar(n);
  for (int i = 0; i < n; ++i) cin >> ar[i];
  while (q--) {
    char s;
    int x;
    cin >> s >> x;
    if (s == '<') {
      if (x >= 0) {
        if (x) push(0, x - 1, 3);
        push(x, NX - 1, 1);
      } else {
        x = 0 - x;
        push(x + 1, NX - 1, 1);
      }
    } else {
      if (x >= 0) {
        push(x + 1, NX - 1, 2);
      } else {
        x = 0 - x;
        push(x, NX - 1, 2);
        push(0, x - 1, 3);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    int s = query(abs(ar[i]));
    ;
    ;
    ;
    switch (s) {
      case 1:
        ar[i] = abs(ar[i]);
        break;
      case 2:
        ar[i] = 0 - abs(ar[i]);
        break;
      case 3:
        ar[i] = 0 - ar[i];
        break;
    }
  }
  cout << ar;
  return 0;
}
