#include <bits/stdc++.h>
using namespace std;
constexpr int maxX = 100005;
struct Node {
  int l, r;
  Node *left, *right;
  int maxVal;
  Node(int l, int r, const vector<int> &init) : l(l), r(r) {
    if (l + 1 == r) {
      left = right = nullptr;
      maxVal = init[l + maxX];
      return;
    }
    int m = (l + r) / 2;
    left = new Node(l, m, init);
    right = new Node(m, r, init);
    maxVal = max(left->maxVal, right->maxVal);
  }
  ~Node() {
    if (left != nullptr) {
      delete left;
    }
    if (right != nullptr) {
      delete right;
    }
  }
  int getMax(int al, int ar) {
    if (al >= ar) {
      return -1;
    }
    if (al <= l && r <= ar) {
      return maxVal;
    }
    if (al >= r || ar <= l) {
      return -1;
    }
    return max(left->getMax(al, ar), right->getMax(al, ar));
  }
};
struct PersNode {
  int l, r;
  PersNode *left, *right;
  int sum;
  PersNode(const PersNode &other)
      : l(other.l),
        r(other.r),
        left(other.left),
        right(other.right),
        sum(other.sum) {}
  PersNode(int l, int r) : l(l), r(r) {
    if (l + 1 == r) {
      left = right = nullptr;
      sum = 0;
      return;
    }
    int m = (l + r) / 2;
    left = new PersNode(l, m);
    right = new PersNode(m, r);
    sum = 0;
  }
  int getSum(int al, int ar) {
    if (al >= ar) {
      return 0;
    }
    if (al <= l && r <= ar) {
      return sum;
    }
    if (al >= r || ar <= l) {
      return 0;
    }
    return left->getSum(al, ar) + right->getSum(al, ar);
  }
  PersNode *insert(int pos) {
    PersNode *newNode = new PersNode(*this);
    if (l + 1 == r) {
      newNode->sum = sum + 1;
      return newNode;
    }
    int m = (l + r) / 2;
    if (pos < m) {
      newNode->left = left->insert(pos);
    } else {
      newNode->right = right->insert(pos);
    }
    newNode->sum = newNode->left->sum + newNode->right->sum;
    return newNode;
  }
};
int main() {
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<int> maxIndL(2 * maxX + 1, -1);
  vector<int> maxIndG(2 * maxX + 1, -1);
  vector<PersNode *> lPers;
  PersNode *lPersTree = new PersNode(-maxX, maxX + 1);
  vector<PersNode *> gPers;
  PersNode *gPersTree = new PersNode(-maxX, maxX + 1);
  for (int i = 0; i < q; ++i) {
    string type;
    int x;
    cin >> type >> x;
    if (type == "<") {
      maxIndL[x + maxX] = i;
      lPersTree = lPersTree->insert(x);
    } else {
      maxIndG[x + maxX] = i;
      gPersTree = gPersTree->insert(x);
    }
    lPers.push_back(lPersTree);
    gPers.push_back(gPersTree);
  }
  Node lTree(-maxX, maxX + 1, maxIndL);
  Node gTree(-maxX, maxX + 1, maxIndG);
  for (auto &val : a) {
    if (val == 0) {
      cout << val << ' ';
      continue;
    }
    int lind = lTree.getMax(-abs(val) + 1, abs(val) + 1);
    int gind = gTree.getMax(-abs(val), abs(val));
    int maxInd;
    string type;
    if (lind > gind) {
      maxInd = lind;
      if (lind != -1) {
        val = abs(val);
      }
    } else {
      maxInd = gind;
      if (gind != -1) {
        val = -abs(val);
      }
    }
    ++maxInd;
    int times = 0;
    times += lPers.back()->getSum(abs(val) + 1, maxX + 1);
    if (maxInd > 0) {
      times -= lPers[maxInd - 1]->getSum(abs(val) + 1, maxX + 1);
    }
    times += gPers.back()->getSum(-maxX, -abs(val));
    if (maxInd > 0) {
      times -= gPers[maxInd - 1]->getSum(-maxX, -abs(val));
    }
    if (times % 2 == 1) {
      val *= -1;
    }
    cout << val << ' ';
  }
  cout << endl;
}
