#include <bits/stdc++.h>
const int offset = 100001;
int a[100005];
std::vector<int> left[200005], right[200005];
int type[100005];
int bit[100005];
void change(int p, int v, int n, int bit[]) {
  while (p <= n) {
    bit[p] += v;
    p += p & -p;
  }
}
int ask(int p, int bit[]) {
  int res = 0;
  while (p != 0) {
    res += bit[p];
    p -= p & -p;
  }
  return res;
}
int max(int a, int b) { return a > b ? a : b; }
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= q; i++) {
    char s[2];
    int x;
    scanf("%s%d", s, &x);
    if (s[0] == '>') {
      right[x + offset + 1].push_back(i);
      if (x + 1 <= 0) change(i, 1, q, bit);
    } else {
      left[x + offset - 1].push_back(i);
      if (x - 1 >= 0) change(i, 1, q, bit);
    }
  }
  int maxn = 0;
  int direct = -1;
  int upper = 100000;
  for (int i = 1; i <= upper; i++) {
    int x = -i;
    for (int p : left[x + offset]) {
      if (p > maxn) {
        maxn = p;
        direct = 0;
      }
    }
    x = i - 1;
    for (int p : left[x + offset]) {
      if (p > maxn) {
        maxn = p;
        direct = 0;
      }
      change(p, -1, q, bit);
    }
    x = -i + 1;
    for (int p : right[x + offset]) {
      if (p > maxn) {
        maxn = p;
        direct = 1;
      }
      change(p, -1, q, bit);
    }
    x = i;
    for (int p : right[x + offset]) {
      if (p > maxn) {
        maxn = p;
        direct = 1;
      }
    }
    int time = ask(q, bit) - ask(maxn, bit);
    if (maxn == 0)
      type[i] = time % 2;
    else {
      int org = direct;
      if (time % 2) org = !org;
      if (!org)
        type[i] = 3;
      else
        type[i] = 2;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0)
      printf("0 ");
    else {
      int u = a[i] >= 0 ? a[i] : -a[i];
      if (type[u] <= 1) {
        if (type[u] == 0)
          printf("%d ", a[i]);
        else
          printf("%d ", -a[i]);
      } else if (type[u] == 2)
        printf("%d ", -u);
      else
        printf("%d ", u);
    }
  }
  printf("\n");
  return 0;
}
