#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
constexpr unsigned long long operator""_k(unsigned long long x) {
  return x * 1000;
}
constexpr unsigned long long operator""_m(unsigned long long x) {
  return x * 1000 * 1000;
}
constexpr unsigned long long operator""_bn(unsigned long long x) {
  return x * 1000 * 1000 * 1000;
}
constexpr int MOD7 = 1_bn + 7;
constexpr int MOD9 = 1_bn + 9;
constexpr int MOD3 = 998244353;
constexpr int M = MOD7;
struct TreeNode {
  bool inversed = false;
  bool sign = false;
  bool push_sign = false;
};
int a[100_k];
TreeNode tree[4 * (200_k + 1) + 10];
void build(int x = 1, int L = 0, int R = 200_k) {
  if (L == R) {
    tree[x].sign = L < 100_k;
    return;
  }
  int M = (L + R) / 2;
  build(2 * x, L, M);
  build(2 * x + 1, M + 1, R);
}
void push(int x, int L, int R) {
  if (L == R) {
    tree[x].sign ^= tree[x].inversed;
    tree[x].inversed = false;
    return;
  }
  if (tree[x].inversed) {
    tree[2 * x].inversed ^= tree[x].inversed;
    tree[2 * x + 1].inversed ^= tree[x].inversed;
    tree[x].sign ^= tree[x].inversed;
    tree[x].inversed = false;
  }
  if (tree[x].push_sign) {
    tree[2 * x].sign = tree[2 * x + 1].sign = tree[x].sign;
    tree[2 * x].inversed = tree[2 * x + 1].inversed = false;
    tree[2 * x].push_sign = tree[2 * x + 1].push_sign = true;
    tree[x].push_sign = false;
  }
}
void setVal(int l, int r, int val, int x = 1, int L = 0, int R = 200_k) {
  if (l > r) return;
  push(x, L, R);
  if (L == l && R == r) {
    if (val <= 1) {
      tree[x].sign = (val == 1);
      tree[x].push_sign = true;
    } else {
      tree[x].inversed ^= true;
    }
    return;
  }
  int M = (L + R) / 2;
  setVal(l, min(r, M), val, 2 * x, L, M);
  setVal(max(l, M + 1), r, val, 2 * x + 1, M + 1, R);
}
bool get(int id, int x = 1, int L = 0, int R = 200_k) {
  push(x, L, R);
  if (L == R) {
    return tree[x].sign ^ tree[x].inversed;
  }
  int M = (L + R) / 2;
  if (id <= M) {
    return get(id, 2 * x, L, M);
  } else {
    return get(id, 2 * x + 1, M + 1, R);
  }
}
int get_index(int x) { return x + (int)100_k; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  build();
  while (q--) {
    char c;
    int x;
    cin >> c >> x;
    if (c == '>') {
      setVal(get_index(-100_k), get_index(-abs(x) - (x >= 0)), 1);
      setVal(get_index(abs(x) + (x >= 0)), get_index(100_k), 1);
      if (x < 0) {
        setVal(get_index(-abs(x) + 1), get_index(abs(x) - 1), 2);
      }
    } else {
      setVal(get_index(-100_k), get_index(-abs(x) - (x <= 0)), 0);
      setVal(get_index(abs(x) + (x <= 0)), get_index(100_k), 0);
      if (x > 0) {
        setVal(get_index(-abs(x) + 1), get_index(abs(x) - 1), 2);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    bool sign = get(get_index(a[i]));
    if (sign) {
      cout << -abs(a[i]) << " ";
    } else {
      cout << abs(a[i]) << " ";
    }
  }
  cout << endl;
}
