#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long triangle(long long x) { return (((long long)(x + 1)) * (x)) / 2; }
pair<long long, long long> add(pair<long long, long long> x,
                               pair<long long, long long> y) {
  return make_pair(x.first + y.first, x.second + y.second);
}
long long modInverse(long long a) {
  long long m = 1000000007;
  long long y = 0, x = 1;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) {
    x += 1000000007;
  }
  return x;
}
int serch(vector<pair<long long, long long> > &x, int num) {
  int l = 0, h = x.size();
  while (l < h) {
    int m = (l + h) / 2;
    if (x[m].first < num) {
      l = m + 1;
    } else {
      h = m;
    }
  }
  return l;
}
vector<vector<int> > segtre(20);
void putone(int d, int p, int num) {
  if (num == 3) {
    segtre[d][p] = 3 - segtre[d][p];
  } else if (num != 0) {
    segtre[d][p] = num;
  }
}
void fix(int x, int y, int num, int depth) {
  if (x > y) {
    return;
  }
  if (depth == 0) {
    if (x < y) {
      for (int i = x; i < y + 1; i += 1) {
        fix(i, i, num, 0);
      }
      return;
    }
    putone(0, x, num);
    return;
  }
  int cur = 1 << depth;
  int x1 = x / cur;
  int x2 = (x + cur - 1) / cur;
  int y1 = (y - cur - 1) / cur;
  if ((y - cur - 1) < 0) {
    y1 = -1;
  }
  int y2 = (y) / cur;
  if (x2 <= y1) {
    putone(depth, x2, num);
    fix(x, x2 * cur - 1, num, depth);
    fix((x2 + 1) * cur, y, num, depth);
    return;
  }
  putone(depth - 1, x1 * 2, segtre[depth][x1]);
  putone(depth - 1, x1 * 2 + 1, segtre[depth][x1]);
  segtre[depth][x1] = 0;
  putone(depth - 1, y2 * 2, segtre[depth][y2]);
  putone(depth - 1, y2 * 2 + 1, segtre[depth][y2]);
  segtre[depth][y2] = 0;
  fix(x, y, num, depth - 1);
}
void fix(int x, int y, int num) { fix(x, y, num, 19); }
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  int m;
  cin >> m;
  vector<pair<long long, long long> > plus;
  vector<pair<long long, long long> > minus;
  for (int i = 0; i < n; i += 1) {
    int a;
    cin >> a;
    if (a > 0) {
      plus.push_back({a, i});
    } else if (a < 0) {
      minus.push_back({-a, i});
    }
  }
  sort(plus.begin(), plus.end());
  sort(minus.begin(), minus.end());
  int nn = plus.size() + minus.size();
  vector<pair<long long, long long> > add(nn);
  for (int i = 0; i < 20; i += 1) {
    segtre[i].resize(n);
  }
  int x = 0, y = 0;
  int k = 0;
  while (x < plus.size() && y < minus.size()) {
    if (plus[x] < minus[y]) {
      add[k] = (plus[x++]);
      segtre[0][k] = 1;
    } else {
      add[k] = (minus[y++]);
      segtre[0][k] = 2;
    }
    k++;
  }
  while (x < plus.size()) {
    add[k] = (plus[x++]);
    segtre[0][k] = 1;
    k++;
  }
  while (y < minus.size()) {
    add[k] = (minus[y++]);
    segtre[0][k] = 2;
    k++;
  }
  for (int i = 0; i < m; i += 1) {
    char c;
    cin >> c;
    int a;
    cin >> a;
    if (c == '<') {
      if (a <= 0) {
        int x = serch(add, -a + 1);
        fix(x, nn - 1, 1);
      } else {
        int x = serch(add, a);
        fix(x, nn - 1, 1);
        fix(0, x - 1, 3);
      }
    } else {
      if (a >= 0) {
        int x = serch(add, a + 1);
        fix(x, nn - 1, 2);
      } else {
        int x = serch(add, -a);
        fix(x, nn - 1, 2);
        fix(0, x - 1, 3);
      }
    }
  }
  vector<int> ans(n);
  for (int i = 0; i < nn; i += 1) {
    int numc = 0;
    for (int j = 20 - 1; j > -1; j -= 1) {
      if (segtre[j][i >> j] == 3) {
        numc = 3 - numc;
      } else if (segtre[j][i >> j] != 0) {
        numc = numc ^ segtre[j][i >> j];
        break;
      }
    }
    ans[add[i].second] = -add[i].first * (2 * numc - 3);
  }
  for (int i = 0; i < n; i += 1) {
    cout << ans[i] << ' ';
  }
  cout << "" << endl;
  return 0;
}
