#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > li2[200001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int buf = 317;
  vector<pair<int, int> > li;
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    li.push_back(make_pair(a, i));
  }
  sort(li.begin(), li.end());
  vector<pair<pair<int, int>, bool> > all;
  if (li[0].first < 0) {
    int st = 0;
    int en = 0;
    while (en + 1 < li.size() && li[en + 1].first < 0) {
      en++;
    }
    all.push_back(make_pair(make_pair(st, en), false));
  }
  if (li.back().first >= 0) {
    int st = li.size() - 1;
    int en = st;
    while (st > 0 && li[st - 1].first >= 0) {
      st--;
    }
    all.push_back(make_pair(make_pair(st, en), false));
  }
  for (int i = 1; i <= q; i++) {
    string s;
    cin >> s;
    int xx;
    cin >> xx;
    vector<pair<pair<int, int>, bool> > tmp;
    for (int j = 0; j < all.size(); j++) {
      int a = li[all[j].first.first].first;
      if (all[j].second) {
        a = -a;
      }
      int b = li[all[j].first.second].first;
      if (all[j].second) {
        b = -b;
      }
      if (s == "<") {
        if (a < xx && b < xx) {
          all[j].second = !all[j].second;
        } else if (!(a < xx) && !(b < xx)) {
          continue;
        } else if (a < xx) {
          int lo = all[j].first.first;
          int hi = all[j].first.second;
          while (lo < hi) {
            int mid = (lo + hi + 1) / 2;
            int cur = li[mid].first;
            if (all[j].second) {
              cur = -cur;
            }
            if (cur < xx) {
              lo = mid;
            } else {
              hi = mid - 1;
            }
          }
          tmp.push_back(
              make_pair(make_pair(lo + 1, all[j].first.second), all[j].second));
          all[j].first.second = lo;
          all[j].second = !all[j].second;
        } else {
          int lo = all[j].first.first;
          int hi = all[j].first.second;
          while (lo < hi) {
            int mid = (lo + hi) / 2;
            int cur = li[mid].first;
            if (all[j].second) {
              cur = -cur;
            }
            if (cur < xx) {
              hi = mid;
            } else {
              lo = mid + 1;
            }
          }
          tmp.push_back(
              make_pair(make_pair(all[j].first.first, lo - 1), all[j].second));
          all[j].first.first = lo;
          all[j].second = !all[j].second;
        }
      } else {
        if (a > xx && b > xx) {
          all[j].second = !all[j].second;
        } else if (!(a > xx) && !(b > xx)) {
          continue;
        } else if (a > xx) {
          int lo = all[j].first.first;
          int hi = all[j].first.second;
          while (lo < hi) {
            int mid = (lo + hi + 1) / 2;
            int cur = li[mid].first;
            if (all[j].second) {
              cur = -cur;
            }
            if (cur > xx) {
              lo = mid;
            } else {
              hi = mid - 1;
            }
          }
          tmp.push_back(
              make_pair(make_pair(lo + 1, all[j].first.second), all[j].second));
          all[j].first.second = lo;
          all[j].second = !all[j].second;
        } else {
          int lo = all[j].first.first;
          int hi = all[j].first.second;
          while (lo < hi) {
            int mid = (lo + hi) / 2;
            int cur = li[mid].first;
            if (all[j].second) {
              cur = -cur;
            }
            if (cur > xx) {
              hi = mid;
            } else {
              lo = mid + 1;
            }
          }
          tmp.push_back(
              make_pair(make_pair(all[j].first.first, lo - 1), all[j].second));
          all[j].first.first = lo;
          all[j].second = !all[j].second;
        }
      }
    }
    while (tmp.size() > 0) {
      all.push_back(tmp.back());
      tmp.pop_back();
    }
    if (i % buf == 0 || i == q) {
      for (int j = 0; j < all.size(); j++) {
        for (int a = all[j].first.first; a <= all[j].first.second; a++) {
          pair<int, int> cur = (li[a]);
          if (all[j].second) {
            cur.first = -cur.first;
          }
          li2[cur.first + 100000].push_back(cur);
        }
      }
      li.clear();
      for (int j = 0; j <= 200000; j++) {
        for (int k = 0; k < li2[j].size(); k++) {
          li.push_back(li2[j][k]);
        }
        li2[j].clear();
      }
      all.clear();
      if (li[0].first < 0) {
        int st = 0;
        int en = 0;
        while (en + 1 < li.size() && li[en + 1].first < 0) {
          en++;
        }
        all.push_back(make_pair(make_pair(st, en), false));
      }
      if (li.back().first >= 0) {
        int st = li.size() - 1;
        int en = st;
        while (st > 0 && li[st - 1].first >= 0) {
          st--;
        }
        all.push_back(make_pair(make_pair(st, en), false));
      }
    }
  }
  int ans[n];
  for (int i = 0; i < n; i++) {
    ans[li[i].second] = li[i].first;
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
}
