#include <bits/stdc++.h>
using namespace std;
int arr[100005];
int tree[4 * (100005 + 10)];
int func(int a, int b) {
  if (a == 3 & b == 3) return 0;
  if (a == 0) return b;
  if (b == 3) {
    if (a == 1) return 2;
    return 1;
  }
  return b;
}
void update(int ql, int qr, int rl, int rr, int idx, int qq) {
  if (tree[idx] != 0) {
    if (rl != rr) {
      tree[2 * idx] = func(tree[2 * idx], tree[idx]);
      tree[2 * idx + 1] = func(tree[2 * idx + 1], tree[idx]);
      tree[idx] = 0;
    }
  }
  if (ql > rr || rl > qr) return;
  if (ql <= rl && rr <= qr) {
    tree[idx] = func(tree[idx], qq);
    if (tree[idx] != 0) {
      if (rl != rr) {
        tree[2 * idx] = func(tree[2 * idx], qq);
        tree[2 * idx + 1] = func(tree[2 * idx + 1], qq);
        tree[idx] = 0;
      }
    }
    return;
  }
  int mid = (rl + rr) >> 1;
  update(ql, qr, rl, mid, 2 * idx, qq);
  update(ql, qr, mid + 1, rr, 2 * idx + 1, qq);
}
int query(int pos, int rl, int rr, int idx) {
  if (tree[idx] != 0) {
    if (rl != rr) {
      tree[2 * idx] = func(tree[2 * idx], tree[idx]);
      tree[2 * idx + 1] = func(tree[2 * idx + 1], tree[idx]);
      tree[idx] = 0;
    }
  }
  if (rl == rr && rl == pos) return tree[idx];
  int mid = (rl + rr) >> 1;
  if (pos <= mid) return query(pos, rl, mid, 2 * idx);
  return query(pos, mid + 1, rr, 2 * idx + 1);
}
int main() {
  int n, i, j, q, l, r, x;
  char ch;
  cin >> n >> q;
  for (i = 0; i < n; i++) cin >> arr[i];
  while (q--) {
    cin >> ch >> x;
    if (ch == '<') {
      if (x <= 0) {
        x = -x;
        update(x + 1, 100005, 0, 100005, 1, 2);
        continue;
      }
      update(0, x - 1, 0, 100005, 1, 3);
      update(x, 100005, 0, 100005, 1, 2);
      continue;
    }
    if (x >= 0) {
      update(x + 1, 100005, 0, 100005, 1, 1);
      continue;
    }
    x = -x;
    update(0, x - 1, 0, 100005, 1, 3);
    update(x, 100005, 0, 100005, 1, 1);
  }
  for (i = 0; i < n; i++) {
    j = query(abs(arr[i]), 0, 100005, 1);
    if (j == 0)
      cout << arr[i] << " ";
    else if (j == 1)
      cout << -abs(arr[i]) << " ";
    else if (j == 2)
      cout << abs(arr[i]) << " ";
    else
      cout << -arr[i] << " ";
  }
  cout << endl;
  return 0;
}
