#include <bits/stdc++.h>
using namespace std;
struct SegmentTree {
  vector<bool> treePos;
  vector<bool> treeNeg;
  vector<bool> flipped;
  long long n, root, size;
  SegmentTree(long long currSize) : n(currSize), root(1) {
    long long x = (long long)(ceil(log2(currSize)));
    size = 2 * (long long)pow(2, x);
    treePos.resize(size, false);
    treeNeg.resize(size, false);
    flipped.resize(size, false);
  }
  void pendingUpdate(long long node, long long start, long long end) {
    if (!flipped[node] && !treePos[node] && !treeNeg[node]) return;
    if (start == end) return;
    if (flipped[node]) {
      if (treePos[2 * node] || treeNeg[2 * node]) {
        swap(treePos[2 * node], treeNeg[2 * node]);
      } else {
        flipped[2 * node] = !flipped[2 * node];
      }
      if (treePos[2 * node + 1] || treeNeg[2 * node + 1]) {
        swap(treePos[2 * node + 1], treeNeg[2 * node + 1]);
      } else {
        flipped[2 * node + 1] = !flipped[2 * node + 1];
      }
    } else if (treePos[node] || treeNeg[node]) {
      flipped[2 * node] = false;
      flipped[2 * node + 1] = false;
      treePos[2 * node] = treePos[node];
      treePos[2 * node + 1] = treePos[node];
      treeNeg[2 * node] = treeNeg[node];
      treeNeg[2 * node + 1] = treeNeg[node];
    }
    treePos[node] = treeNeg[node] = flipped[node] = false;
  }
  void updateRange(long long l, long long r, long long type) {
    updateRange(root, 0, n - 1, l, r, type);
  }
  void updateRange(long long node, long long start, long long end, long long l,
                   long long r, long long type) {
    pendingUpdate(node, start, end);
    if (start > end || start > r || end < l) return;
    if (start >= l && end <= r) {
      if (type == 0) {
        if (treePos[node] || treeNeg[node]) {
          swap(treePos[node], treeNeg[node]);
        } else {
          flipped[node] = !flipped[node];
        }
      } else {
        flipped[node] = false;
        if (type == 1) {
          treePos[node] = true;
          treeNeg[node] = false;
        } else {
          treeNeg[node] = true;
          treePos[node] = false;
        }
      }
      return;
    }
    long long mid = (start + end) / 2;
    updateRange(2 * node, start, mid, l, r, type);
    updateRange(2 * node + 1, mid + 1, end, l, r, type);
  }
  long long querySum(long long pos) { return querySum(root, 0, n - 1, pos); }
  long long querySum(long long node, long long start, long long end,
                     long long pos) {
    if (pos < start || end < pos) return 0;
    pendingUpdate(node, start, end);
    if (pos <= start && end <= pos) {
      if (!flipped[node] && !treePos[node] && !treeNeg[node]) return 4;
      if (flipped[node]) {
        assert(!treePos[node] && !treeNeg[node]);
        return 1;
      }
      assert(treePos[node] ^ treeNeg[node]);
      if (treePos[node]) return 2;
      if (treeNeg[node]) return 3;
      assert(false);
      return 0;
    }
    long long mid = (start + end) / 2;
    if (pos <= mid) return querySum(2 * node, start, mid, pos);
    return querySum(2 * node + 1, mid + 1, end, pos);
  }
};
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, q;
  cin >> n >> q;
  vector<long long> arr(n);
  for (long long i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  const long long mx = 1e5 + 10;
  SegmentTree st(mx);
  for (long long i = 0; i < q; ++i) {
    char sign;
    long long val;
    cin >> sign >> val;
    const long long onlyPos = 1;
    const long long onlyNeg = 2;
    if (sign == '>' && val < 0) {
      st.updateRange(0, abs(val) - 1, 0);
      st.updateRange(abs(val), mx - 1, onlyNeg);
    } else if (sign == '>') {
      st.updateRange(val + 1, mx - 1, onlyNeg);
    } else if (sign == '<' && val > 0) {
      st.updateRange(0, val - 1, 0);
      st.updateRange(val, mx - 1, onlyPos);
    } else {
      st.updateRange(abs(val) + 1, mx - 1, onlyPos);
    }
  }
  for (long long i = 0; i < n; ++i) {
    long long res = st.querySum(abs(arr[i]));
    assert(res != 0);
    if (res == 4)
      cout << arr[i] << ' ';
    else if (res == 1)
      cout << -arr[i] << ' ';
    else if (res == 2)
      cout << abs(arr[i]) << ' ';
    else
      cout << -abs(arr[i]) << ' ';
  }
}
