#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
long long lazy_state[4][4] = {
    {0, 1, 2, 3}, {1, 0, 2, 3}, {2, 3, 2, 3}, {3, 2, 2, 3}};
int curr = 1;
struct Vertex {
  int left = -1, right = -1;
  pair<long long int, long long int> value;
  int lazy = 0;
  pair<long long int, long long int> og;
  long long l = 0, r = 0;
  Vertex() {}
  Vertex(vector<pair<long long int, long long int> > &arr, int a, int b,
         vector<Vertex> &SegTree) {
    l = a;
    r = b;
    if (l == r) {
      value = arr[l];
      og = value;
    } else {
      left = curr;
      curr++;
      SegTree.push_back(Vertex());
      SegTree[left] = Vertex(arr, a, (a + b) / 2, SegTree);
      right = curr;
      curr++;
      SegTree.push_back(Vertex());
      SegTree[right] = Vertex(arr, (a + b) / 2 + 1, b, SegTree);
      recalculate(SegTree);
    }
  }
  void recalculate(vector<Vertex> &SegTree) {
    if (left != -1)
      value = {SegTree[right].value.first + SegTree[left].value.first,
               SegTree[right].value.second + SegTree[left].value.second};
    else {
      value = og;
    }
    if (lazy == 1) {
      swap(value.first, value.second);
    } else if (lazy == 2) {
      value.first += value.second;
      value.second = 0;
    } else if (lazy == 3) {
      value.second += value.first;
      value.second = 0;
    }
  }
  void push(vector<Vertex> &SegTree) {
    if (lazy == 0) {
      return;
    }
    SegTree[right].lazy = lazy_state[SegTree[right].lazy][lazy];
    SegTree[right].recalculate(SegTree);
    SegTree[left].lazy = lazy_state[SegTree[left].lazy][lazy];
    SegTree[left].recalculate(SegTree);
    lazy = 0;
  }
  void update(int a, int b, int val, vector<Vertex> &SegTree) {
    if (a <= l && b >= r) {
      lazy = lazy_state[lazy][val];
      recalculate(SegTree);
    } else if (a > r || b < l) {
      return;
    } else {
      push(SegTree);
      SegTree[left].update(a, b, val, SegTree);
      SegTree[right].update(a, b, val, SegTree);
      recalculate(SegTree);
    }
  }
  void global_push(vector<Vertex> &SegTree) {
    if (left == -1) {
      return;
    } else {
      push(SegTree);
      SegTree[left].global_push(SegTree);
      SegTree[right].global_push(SegTree);
    }
  }
};
struct SegmentTree {
  vector<Vertex> SegTree;
  SegmentTree(vector<pair<long long int, long long int> > &arr) {
    SegTree.push_back(Vertex());
    SegTree[0] = Vertex(arr, 0, arr.size() - 1, SegTree);
  }
  void global_push() { SegTree[0].global_push(SegTree); }
  void update(int a, int b, int val) { SegTree[0].update(a, b, val, SegTree); }
  vector<int> query() {
    vector<int> arr(1e5 + 1);
    for (int i = 0; i < SegTree.size(); i++) {
      if (SegTree[i].l == SegTree[i].r) {
        arr[SegTree[i].l] = SegTree[i].lazy;
      }
    }
    return arr;
  }
};
void pre() {}
void solve() {
  long long int n, d, q;
  cin >> n >> q;
  vector<pair<long long int, long long int> > arr(1e5 + 1);
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> d;
    a[i] = d;
    if (d < 0) {
      arr[-1 * d].second++;
    } else {
      arr[d].first++;
    }
  }
  SegmentTree s(arr);
  char c;
  for (int i = 0; i < q; i++) {
    cin >> c >> d;
    if (c == '<') {
      if (d <= 0) {
        d--;
        d *= -1;
        s.update(d, 1e5, 2);
      } else {
        d--;
        s.update(d + 1, 1e5, 2);
        s.update(0, d, 1);
      }
    } else {
      if (d >= 0) {
        s.update(d + 1, 1e5, 3);
      } else {
        d *= -1;
        s.update(d, 1e5, 3);
        s.update(0, d - 1, 1);
      }
    }
  }
  s.global_push();
  auto b = s.query();
  for (int i = 0; i < n; i++) {
    if ((a[i] > 0 && (b[abs(a[i])] == 0 || b[abs(a[i])] == 2)) ||
        (a[i] < 0 && (b[abs(a[i])] == 0 || b[abs(a[i])] == 3))) {
      cout << a[i] << " ";
    } else {
      cout << -1 * a[i] << " ";
    }
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  pre();
  long long int num = 1;
  for (long long int i = 0; i < num; i++) {
    solve();
  }
}
