#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int segtree[4 * 200001], lazy[4 * 200001], a[100001];
void push_lazy(int node, int l, int r) {
  if (l == r) {
    switch (lazy[node]) {
      case 1:
        segtree[node] = -segtree[node];
        break;
      case 2:
        segtree[node] = 1;
        break;
      case 3:
        segtree[node] = -1;
        break;
    }
  } else {
    switch (lazy[node * 2]) {
      case 1:
        if (lazy[node] == 1)
          lazy[node * 2] = 0;
        else
          lazy[node * 2] = lazy[node];
        break;
      case 0:
        lazy[node * 2] = lazy[node];
        break;
      default:
        if (lazy[node] != lazy[node * 2]) lazy[node * 2] = 5 - lazy[node * 2];
    }
    switch (lazy[node * 2 + 1]) {
      case 1:
        if (lazy[node] == 1)
          lazy[node * 2 + 1] = 0;
        else
          lazy[node * 2 + 1] = lazy[node];
        break;
      case 0:
        lazy[node * 2 + 1] = lazy[node];
        break;
      default:
        if (lazy[node] != lazy[node * 2 + 1])
          lazy[node * 2 + 1] = 5 - lazy[node * 2 + 1];
    }
  }
}
void build(int node = 1, int l = 1, int r = 200001) {
  if (l == r) {
    if (l < 100001)
      segtree[node] = -1;
    else
      segtree[node] = 1;
  } else {
    int mid = (l + r) / 2;
    build(node * 2, l, mid);
    build(node * 2 + 1, mid + 1, r);
  }
}
int query(int a, int node = 1, int l = 1, int r = 200001) {
  if (lazy[node]) {
    push_lazy(node, l, r);
    lazy[node] = 0;
  }
  if (l == r) return segtree[node];
  int mid = (l + r) / 2;
  if (a > mid) return query(a, node * 2 + 1, mid + 1, r);
  return query(a, node * 2, l, mid);
}
void update(int a, int b, int val, int node = 1, int l = 1, int r = 200001) {
  if (lazy[node]) {
    push_lazy(node, l, r);
    lazy[node] = 0;
  }
  if (l > b || r < a || b < a) return;
  if (l >= a && r <= b) {
    lazy[node] = val;
  } else {
    int mid = (l + r) / 2;
    update(a, b, val, node * 2, l, mid);
    update(a, b, val, node * 2 + 1, mid + 1, r);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> a[i];
  build();
  for (int i = 0; i < q; i++) {
    char c;
    int k;
    cin >> c >> k;
    if (c == '>' && k <= 0) {
      update(100001 + k + 1, 100001 - k - 1, 1);
      update(1, 100001 + k, 3);
      update(100001 - k, 200001, 3);
    } else if (c == '<' && k >= 0) {
      update(100001 - k + 1, 100001 + k - 1, 1);
      update(1, 100001 - k, 2);
      update(100001 + k, 200001, 2);
    } else if (k > 0) {
      update(1, 100001 - k - 1, 3);
      update(100001 + k + 1, 200001, 3);
    } else {
      update(1, 100001 + k - 1, 2);
      update(100001 - k + 1, 200001, 2);
    }
  }
  for (int i = 0; i < n; i++) {
    if (query(a[i] + 100001) == -1)
      cout << -(abs(a[i])) << ' ';
    else
      cout << abs(a[i]) << ' ';
  }
  cout << '\n';
  return 0;
}
