#include <bits/stdc++.h>
using namespace std;
int a[100000], a2[100000];
int arr[2 * 100010 + 10], arr2[2 * 100010 + 10];
vector<int> sw[100010 + 10];
int num[2 * 100010 + 10];
int bit[100010 + 20];
int update(int i) {
  for (i++; i < 100010 + 20; i += i & (-i)) bit[i] ^= 1;
  return 0;
}
int query(int i) {
  int s = 0;
  for (i++; i > 0; i -= i & (-i)) s ^= bit[i];
  return s;
}
int main() {
  int i;
  int n, q, x;
  char s;
  scanf("%d %d", &n, &q);
  for (i = 0; i < n; i++) scanf("%d", &a[i]), a2[i] = a[i];
  for (i = 0; i < q; i++) {
    scanf(" %c %d", &s, &x);
    if (s == '>') {
      x++;
      if (x >= 0)
        arr[x + 100010] = max(arr[x + 100010], i + 1);
      else {
        arr[-x + 1 + 100010] = max(arr[-x + 1 + 100010], i + 1);
        sw[-x].push_back(i + 1);
      }
    } else {
      x--;
      if (x <= 0)
        arr2[x + 100010] = max(arr2[x + 100010], i + 1);
      else {
        arr2[-x - 1 + 100010] = max(arr2[-x - 1 + 100010], i + 1);
        sw[x].push_back(i + 1);
      }
    }
  }
  for (i = -100010 + 1; i <= 100010; i++)
    arr[i + 100010] = max(arr[i + 100010], arr[i - 1 + 100010]);
  for (i = 100010 - 1; i >= -100010; i--)
    arr2[i + 100010] = max(arr2[i + 100010], arr2[i + 1 + 100010]);
  for (i = 100010; i >= 0; i--) {
    int j;
    for (j = 0; j < sw[i].size(); j++) update(100010 + 10 - sw[i][j]);
    int m = max(arr[i + 100010], arr2[-i + 100010]);
    if (m == 0)
      num[i + 100010] = i, num[-i + 100010] = -i;
    else if (arr[i + 100010] == m)
      num[i + 100010] = num[-i + 100010] = -i;
    else
      num[i + 100010] = num[-i + 100010] = i;
    if (query(100010 + 10 - m)) num[i + 100010] *= -1, num[-i + 100010] *= -1;
  }
  for (i = 0; i < n; i++) {
    printf("%d", num[a[i] + 100010]);
    if (i < n - 1)
      printf(" ");
    else
      printf("\n");
  }
  return 0;
}
