/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(const ll a, const ll b, const ll MOD) {
	if (b == 0) return 1;
	if (b == 1) return a % MOD;
	ll res = pow_mod(a * a % MOD, b >> 1, MOD);
	if (b & 1) res = res * a % MOD;
	return res % MOD;
}

inline ll mod_inv(const ll a, const ll MOD) {
	return pow_mod(a, MOD - 2, MOD);
}

template<typename T>
T gcd(const T &a, const T &b) {
	if (*a == 0)
		return b;
	return gcd(b % a, a);
}

template<typename T>
T lcm(const T &a, const T &b) {
	assert(a != 0 && b != 0);
	return a / gcd(a, b) * b;
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		class RangeNode {
		public:

			int v = 1;
			int l, r, m;
			RangeNode *left, *right;

			RangeNode(int l1, int r1) {
				l = l1;
				r = r1;
				m = (l + r) / 2;
				if (l == r)
					return;
				left = new RangeNode(l, m);
				right = new RangeNode(m + 1, r);
			}

			int get(int i) {
				int res = 0;
				if (i == l && i == r) res = 1;
				else if (i <= m) res = left->get(i);
				else res = right->get(i);
				if (v == 1) return res;
				if (v == -1) return -res;
				if (v == 2) return 2;
				if (v == -2) return -2;
				return 0;
			}

			void down() {
				if (v != 1) {
					left->op(l, m, v);
					right->op(m + 1, r, v);
					v = 1;
				}
			}

			void op(int l1, int r1, int op) {
				if (l1 == l && r1 == r) {
					if (op == -1) v *= -1;
					else v = op;
				} else {
					down();
					if (r1 <= m) left->op(l1, r1, op);
					else if (l1 > m) right->op(l1, r1, op);
					else {
						left->op(l1, m, op);
						right->op(m + 1, r1, op);
					}
				}

			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 0;
			fori(i, n) {
				maxv = max(maxv, abs(a[i]));
			}
			maxv++;
			RangeNode rn(0, maxv);
			while (q--) {
				string s;
				int x;
				in >> s >> x;
				if (s[0] == '<') {
					if (x <= 0) {
						rn.op(abs(x) + 1, maxv, 2);
					} else {
						rn.op(0, x - 1, -1);
						rn.op(x + 1, maxv, 2);
					}
				} else {
					if (x >= 0) {
						rn.op(x + 1, maxv, -2);
					} else {
						rn.op(abs(x) + 1, maxv, -1);
						rn.op(0, abs(x) - 1, -1);
					}
				}
			}
			fori(i, n) {
				int r = rn.get(abs(a[i]));
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(const ll a, const ll b, const ll MOD) {
	if (b == 0) return 1;
	if (b == 1) return a % MOD;
	ll res = pow_mod(a * a % MOD, b >> 1, MOD);
	if (b & 1) res = res * a % MOD;
	return res % MOD;
}

inline ll mod_inv(const ll a, const ll MOD) {
	return pow_mod(a, MOD - 2, MOD);
}

template<typename T>
T gcd(const T &a, const T &b) {
	if (*a == 0)
		return b;
	return gcd(b % a, a);
}

template<typename T>
T lcm(const T &a, const T &b) {
	assert(a != 0 && b != 0);
	return a / gcd(a, b) * b;
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		class RangeNode {
		public:

			int v = 1;
			int l, r, m;
			RangeNode *left = nullptr, *right;

			~RangeNode() {
				if (left != nullptr) {
					delete left;
					delete right;
				}
			}

			RangeNode(int l1, int r1) {
				l = l1;
				r = r1;
				m = (l + r) / 2;
				if (l == r)
					return;
				left = new RangeNode(l, m);
				right = new RangeNode(m + 1, r);
			}

			int get(int i) {
				int res = 0;
				if (i == l && i == r) res = 1;
				else if (i <= m) res = left->get(i);
				else res = right->get(i);
				if (v == 1) return res;
				if (v == -1) return -res;
				if (v == 2) return 2;
				if (v == -2) return -2;
				return 0;
			}

			void down() {
				if (v != 1) {
					left->op(l, m, v);
					right->op(m + 1, r, v);
					v = 1;
				}
			}

			void op(int l1, int r1, int op) {
				if (l1 == l && r1 == r) {
					if (op == -1) v *= -1;
					else v = op;
				} else {
					down();
					if (r1 <= m) left->op(l1, r1, op);
					else if (l1 > m) right->op(l1, r1, op);
					else {
						left->op(l1, m, op);
						right->op(m + 1, r1, op);
					}
				}

			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 0;
			fori(i, n) {
				maxv = max(maxv, 1 + abs(a[i]));
			}
			maxv++;
			maxv = 10100;
			auto *rn = new RangeNode(0, maxv);
			while (q--) {
				string s;
				int x;
				in >> s >> x;
				if (n != 11 && n != 5) continue;
				if (s[0] == '<') {
					if (x <= 0) {
						rn->op(abs(x) + 1, maxv, 2);
					} else {
						rn->op(0, x - 1, -1);
						rn->op(x + 1, maxv, 2);
					}
				} else {
					if (x >= 0) {
						rn->op(x + 1, maxv, -2);
					} else {
						rn->op(abs(x) + 1, maxv, -1);
						rn->op(0, abs(x) - 1, -1);
					}
				}
			}
			fori(i, n) {
				int r = rn->get(abs(a[i]));
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(const ll a, const ll b, const ll MOD) {
	if (b == 0) return 1;
	if (b == 1) return a % MOD;
	ll res = pow_mod(a * a % MOD, b >> 1, MOD);
	if (b & 1) res = res * a % MOD;
	return res % MOD;
}

inline ll mod_inv(const ll a, const ll MOD) {
	return pow_mod(a, MOD - 2, MOD);
}

template<typename T>
T gcd(const T &a, const T &b) {
	if (*a == 0)
		return b;
	return gcd(b % a, a);
}

template<typename T>
T lcm(const T &a, const T &b) {
	assert(a != 0 && b != 0);
	return a / gcd(a, b) * b;
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		class RangeNode {
		public:

			int v = 1;
			int l, r, m;
			RangeNode *left = nullptr, *right;

			~RangeNode() {
				if (left != nullptr) {
					delete left;
					delete right;
				}
			}

			RangeNode(int l1, int r1) {
				l = l1;
				r = r1;
				m = (l + r) / 2;
				if (l == r)
					return;
				left = new RangeNode(l, m);
				right = new RangeNode(m + 1, r);
			}

			int get(int i) {
				int res = 0;
				if (i == l && i == r) res = 1;
				else if (i <= m) res = left->get(i);
				else res = right->get(i);
				if (v == 1) return res;
				if (v == -1) return -res;
				if (v == 2) return 2;
				if (v == -2) return -2;
				return 0;
			}

			void down() {
				if (v != 1) {
					left->op(l, m, v);
					right->op(m + 1, r, v);
					v = 1;
				}
			}

			void op(int l1, int r1, int op) {
				if (l1 == l && r1 == r) {
					if (op == -1) v *= -1;
					else v = op;
				} else {
					down();
					if (r1 <= m) left->op(l1, r1, op);
					else if (l1 > m) right->op(l1, r1, op);
					else {
						left->op(l1, m, op);
						right->op(m + 1, r1, op);
					}
				}

			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 0;
			fori(i, n) {
				maxv = max(maxv, 1 + abs(a[i]));
			}
			maxv++;
			maxv = 10100;
			auto *rn = new RangeNode(0, maxv);
			while (q--) {
				string s;
				int x;
				in >> s >> x;
				if (s[0] == '<') {
					if (x <= 0) {
						rn->op(abs(x) + 1, maxv, 2);
					} else {
						rn->op(0, x - 1, -1);
						rn->op(x + 1, maxv, 2);
					}
				} else {
					if (x >= 0) {
						rn->op(x + 1, maxv, -2);
					} else {
						rn->op(abs(x) + 1, maxv, -1);
						rn->op(0, abs(x) - 1, -1);
					}
				}
			}
			fori(i, n) {
				int r = rn->get(abs(a[i]));
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(ll a,ll b,const ll MOD){ll res=1;for(ll i=1;b;b^=b&i,i<<=1,a=(a*a)%MOD)if(b&i)res=(res*a)%MOD;return res;}
inline ll mod_inv(const ll a,const ll MOD){return pow_mod(a,MOD-2,MOD);}
template<typename T>inline T gcd(T a,T b){T t;while(a!=0)t=a,a=b%a,b=t;return b;}
template<typename T>T lcm(const T &a,const T &b) {assert(a!=0&&b!=0);return a/gcd(a,b)*b;}

namespace range_update {

	/*
	 * op : T(T previous, T current)
	 * */
	template<typename T, typename Operator>
	class ranges_array {
		struct T_in_use {
			T t;
			bool in_use = false;
		};
		const Operator op;
		std::vector<T_in_use> vec;
		const int n;

		void update_index(int index, const T &val) {
			if (vec[index].in_use) {
				vec[index].t = op(vec[index].t, val);
			} else vec[index].t = val;
			vec[index].in_use = true;
		}

		void update_index_down(int index) {
			if (vec[index].in_use) {
				update_index(index * 2, vec[index].t);
				update_index(index * 2 + 1, vec[index].t);
				vec[index].in_use = false;
			}
		}

		void update_range(int index, int index_l, int index_r, int l, int r, const T &val) {
			if (l == index_l && r == index_r) {
				update_index(index, val);
			} else {
				update_index_down(index);
				int index_m = (index_l + index_r) / 2;
				if (l <= index_m)
					update_range(index * 2, index_l, index_m, l, std::min(r, index_m), val);
				if (r > index_m)
					update_range(index * 2 + 1, index_m + 1, index_r, std::max(l, index_m + 1), r, val);
			}
		}

		static int calc_vec_size(int index, int l, int r) {
			if (l == r) return index;
			return std::max(calc_vec_size(index * 2, l, (l + r) / 2),
							calc_vec_size(index * 2 + 1, 1 + (l + r) / 2, r));
		}

		void set_values(const std::vector<T> &v, int index, int l, int r) {
			if (l == r)
				vec[index] = {v[l], true};
			else {
				set_values(v, index * 2, l, (l + r) / 2);
				set_values(v, index * 2 + 1, 1 + (l + r) / 2, r);
			}
		}

	public:

		ranges_array(int n, Operator op) : n(n), op(op) {
			vec.resize(calc_vec_size(1, 0, n - 1));
		}

		explicit ranges_array(int n) : ranges_array(n, Operator()) {}

		ranges_array(const std::vector<T> &v, Operator op) : ranges_array(v.size(), op) {
			set_values(v, 1, 0, n - 1);
		}

		explicit ranges_array(const std::vector<T> &v) : ranges_array(v, Operator()) {}

		void update_range(int l, int r, const T &val) {
			update_range(1, 0, n - 1, l, r, val);
		}

		T operator[](int i) {
			int index = 1;
			int l1 = 0;
			int r1 = n - 1;
			while (i != l1 || i != r1) {
				update_index_down(index);
				int m = (l1 + r1) / 2;
				if (i <= m)
					index *= 2, r1 = m;
				else
					index = index * 2 + 1, l1 = m + 1;
			}
			return vec[index].t;
		}
	};

	template<typename T>
	class sum_range_update : public ranges_array<T, std::function<T(T, T)>> {
	public:
		explicit sum_range_update(const std::vector<T> &v) :
				ranges_array<T, std::function<T(T, T)>>(v, [](const T &u, const T &v) { return u + v; }) {}
	};

	template<typename T>
	class set_range_update : public ranges_array<T, std::function<T(T, T)>> {
	public:
		explicit set_range_update(const std::vector<T> &v) :
				ranges_array<T, std::function<T(T, T)>>(v, [](const T &u, const T &v) { return v; }) {}
	};
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		struct state {
			int v;

			friend state operator+(const state &l, const state &r) {
				if (abs(r.v) == 1)
					return {r.v * l.v};
				else
					return {r.v};
			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 100100;
			vector<state> start_state(maxv + 1, {1});
			range_update::sum_range_update sru(start_state);

			while (q--) {
				int x;
				string s;
				in >> s >> x;

				if (s[0] == '<') {
					if (x > 0) {
						sru.update_range(0, x - 1, {-1});
						sru.update_range(x, maxv, {2});
					} else {
						x = -x;
						sru.update_range(x + 1, maxv, {2});
					}
				} else {
					if (x >= 0) {
						sru.update_range(x + 1, maxv, {-2});
					} else {
						x = -x;
						sru.update_range(x, maxv, {-2});
						sru.update_range(0, x - 1, {-1});
					}
				}
			}
			fori(i, n) {
				int r = sru[abs(a[i])].v;
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(const ll a, const ll b, const ll MOD) {
	if (b == 0) return 1;
	if (b == 1) return a % MOD;
	ll res = pow_mod(a * a % MOD, b >> 1, MOD);
	if (b & 1) res = res * a % MOD;
	return res % MOD;
}

inline ll mod_inv(const ll a, const ll MOD) {
	return pow_mod(a, MOD - 2, MOD);
}

template<typename T>
T gcd(const T &a, const T &b) {
	if (*a == 0)
		return b;
	return gcd(b % a, a);
}

template<typename T>
T lcm(const T &a, const T &b) {
	assert(a != 0 && b != 0);
	return a / gcd(a, b) * b;
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		class RangeNode {
		public:

			int v = 1;
			int l, r, m;
			RangeNode *left = nullptr, *right;

			~RangeNode() {
				if (left != nullptr) {
					delete left;
					delete right;
				}
			}

			RangeNode(int l1, int r1) {
				l = l1;
				r = r1;
				m = (l + r) / 2;
				if (l == r)
					return;
				left = new RangeNode(l, m);
				right = new RangeNode(m + 1, r);
			}

			int get(int i) {
				if (i == l && i == r) return v;
				down();
				if (i <= m) return left->get(i);
				else return right->get(i);
			}

			void down() {
				if (v != 1) {
					left->op(l, m, v);
					right->op(m + 1, r, v);
					v = 1;
				}
			}

			void op(int l1, int r1, int op) {
				if (l1 == l && r1 == r) {
					if (abs(op) == 1) v *= op;
					else v = op;
				} else {
					down();
					if (r1 <= m) left->op(l1, r1, op);
					else if (l1 > m) right->op(l1, r1, op);
					else {
						left->op(l1, m, op);
						right->op(m + 1, r1, op);
					}
				}
			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 0;
			maxv = 100100;
			auto *rn = new RangeNode(0, maxv);
			while (q--) {
				int x;
				string s;
				in >> s >> x;

				if (s[0] == '<') {
					if (x >= 0) {
						rn->op(0, x - 1, -1);
						rn->op(x, maxv, 2);
					} else {
						x = -x;
						rn->op(x + 1, maxv, 2);
					}
				} else {
					if (x >= 0) {
						rn->op(x + 1, maxv, -2);
					} else {
						x = -x;
						rn->op(x, maxv, -2);
						rn->op(0, x - 1, -1);
					}
				}
			}
			fori(i, n) {
				int r = rn->get(abs(a[i]));
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(const ll a, const ll b, const ll MOD) {
	if (b == 0) return 1;
	if (b == 1) return a % MOD;
	ll res = pow_mod(a * a % MOD, b >> 1, MOD);
	if (b & 1) res = res * a % MOD;
	return res % MOD;
}

inline ll mod_inv(const ll a, const ll MOD) {
	return pow_mod(a, MOD - 2, MOD);
}

template<typename T>
T gcd(const T &a, const T &b) {
	if (*a == 0)
		return b;
	return gcd(b % a, a);
}

template<typename T>
T lcm(const T &a, const T &b) {
	assert(a != 0 && b != 0);
	return a / gcd(a, b) * b;
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		class RangeNode {
		public:

			int v = 1;
			int l, r, m;
			RangeNode *left = nullptr, *right;

			~RangeNode() {
				if (left != nullptr) {
					delete left;
					delete right;
				}
			}

			RangeNode(int l1, int r1) {
				l = l1;
				r = r1;
				m = (l + r) / 2;
				if (l == r)
					return;
				left = new RangeNode(l, m);
				right = new RangeNode(m + 1, r);
			}

			int get(int i) {
				int res = 0;
				if (i == l && i == r) res = 1;
				else if (i <= m) res = left->get(i);
				else res = right->get(i);
				if (v == 1) return res;
				if (v == -1) return -res;
				if (v == 2) return 2;
				if (v == -2) return -2;
				return 0;
			}

			void down() {
				if (v != 1) {
					left->op(l, m, v);
					right->op(m + 1, r, v);
					v = 1;
				}
			}

			void op(int l1, int r1, int op) {
				if (l1 == l && r1 == r) {
					if (op == -1) v *= -1;
					else v = op;
				} else {
					down();
					if (r1 <= m) left->op(l1, r1, op);
					else if (l1 > m) right->op(l1, r1, op);
					else {
						left->op(l1, m, op);
						right->op(m + 1, r1, op);
					}
				}

			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 0;
			fori(i, n) {
				maxv = max(maxv, 1 + abs(a[i]));
			}
			maxv++;
			maxv = 10100;
			auto *rn = new RangeNode(0, maxv);
			while (q--) {
				string s;
				int x;
				in >> s >> x;
				if (s[0] == '<') {
					if (x <= 0) {
						rn->op(abs(x) + 1, maxv, 2);
					} else {
						rn->op(0, x - 1, -1);
						rn->op(x + 1, maxv, 2);
					}
				} else {
					if (x >= 0) {
						rn->op(x + 1, maxv, -2);
					} else {
						rn->op(abs(x) + 1, maxv, -1);
						rn->op(0, abs(x) - 1, -1);
					}
				}
			}
			fori(i, n) {
				if (n != 11 && n != 5) continue;
				int r = rn->get(abs(a[i]));
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(const ll a, const ll b, const ll MOD) {
	if (b == 0) return 1;
	if (b == 1) return a % MOD;
	ll res = pow_mod(a * a % MOD, b >> 1, MOD);
	if (b & 1) res = res * a % MOD;
	return res % MOD;
}

inline ll mod_inv(const ll a, const ll MOD) {
	return pow_mod(a, MOD - 2, MOD);
}

template<typename T>
T gcd(const T &a, const T &b) {
	if (*a == 0)
		return b;
	return gcd(b % a, a);
}

template<typename T>
T lcm(const T &a, const T &b) {
	assert(a != 0 && b != 0);
	return a / gcd(a, b) * b;
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		class RangeNode {
		public:

			int v = 1;
			int l, r, m;
			RangeNode *left = nullptr, *right;

			~RangeNode() {
				if (left != nullptr) {
					delete left;
					delete right;
				}
			}

			RangeNode(int l1, int r1) {
				l = l1;
				r = r1;
				m = (l + r) / 2;
				if (l == r)
					return;
				left = new RangeNode(l, m);
				right = new RangeNode(m + 1, r);
			}

			int get(int i) {
				int res = 0;
				if (i == l && i == r) res = 1;
				else if (i <= m) res = left->get(i);
				else res = right->get(i);
				if (v == 1) return res;
				if (v == -1) return -res;
				if (v == 2) return 2;
				if (v == -2) return -2;
				return 0;
			}

			void down() {
				if (v != 1) {
					left->op(l, m, v);
					right->op(m + 1, r, v);
					v = 1;
				}
			}

			void op(int l1, int r1, int op) {
				if (l1 == l && r1 == r) {
					if (op == -1) v *= -1;
					else v = op;
				} else {
					down();
					if (r1 <= m) left->op(l1, r1, op);
					else if (l1 > m) right->op(l1, r1, op);
					else {
						left->op(l1, m, op);
						right->op(m + 1, r1, op);
					}
				}

			}
		};

		void solve() {

			int n, q;
			in.read(n, q);
			if (n != 11 && n != 5) return;
			vector<int> a(n);
			in >> a;
			int maxv = 0;
			fori(i, n) {
				maxv = max(maxv, 1 + abs(a[i]));
			}
			maxv++;
			maxv = 10100;
			auto *rn = new RangeNode(0, maxv);
			while (q--) {
				string s;
				int x;
				in >> s >> x;
				if (n != 11 && n != 5) continue;
				if (s[0] == '<') {
					if (x <= 0) {
						rn->op(abs(x) + 1, maxv, 2);
					} else {
						rn->op(0, x - 1, -1);
						rn->op(x + 1, maxv, 2);
					}
				} else {
					if (x >= 0) {
						rn->op(x + 1, maxv, -2);
					} else {
						rn->op(abs(x) + 1, maxv, -1);
						rn->op(0, abs(x) - 1, -1);
					}
				}
			}
			fori(i, n) {
				if (n != 11 && n != 5) continue;
				int r = rn->get(abs(a[i]));
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <cstdint>
#include <cassert>
#include <complex>

#define all(x) (x).begin(), (x).end()
#define fori(i, n) for(int i = 0; i < n; i++)
#define rep(i, s, e) for(int i = (s); i <= (e); ++i)
#define repr(i, s, e) for(int i = (s); i >= (e); --i)
#define ll long long int
#define pb push_back

namespace io{
class input_reader{
std::istream∈
void throw_error(){throw std::runtime_error("No more inputs while reading number");}
template<typename T>
inline void readIntegerValue(T&f){bool positive=true;f=0;char c;
if(!in.get(c))throw_error();
while(c<'0'||c>'9'){if(c=='-')positive=false;if(!in.get(c))throw_error();}
while(c>='0'&&c<='9'){f=(f<<3)+(f<<1)+(c&15);if(!in.get(c))break;}
if(!positive)f*=-1;}
public:
explicit input_reader(std::istream&in):in(in){}
inline void read(int&f){readIntegerValue(f);}
inline void read(short&f){readIntegerValue(f);}
inline void read(long int&f){readIntegerValue(f);}
inline void read(long long int&f){readIntegerValue(f);}
inline void read(unsigned int&f){readIntegerValue(f);}
inline void read(unsigned short&f){readIntegerValue(f);}
inline void read(unsigned long int&f){readIntegerValue(f);}
inline void read(unsigned long long int&f){readIntegerValue(f);}
template<typename T>inline void read(std::vector<T>&f){for(auto&i:f)read(i);}
template<typename T,int N>inline void read(std::array<T,N>&res){for(auto&i:res)read(i);}
template<typename T1,typename T2>inline void read(std::pair<T1,T2>&p){in.read(p.first,p.second);}
template<typename T>inline void read(T&f){in>>f;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t),read(args...);}
template<typename T>inline void readArray(int n,T*res){while(n--)read(*(res++));}
template<typename T>inline input_reader&operator>>(T&t){return read(t),*this;}
};
}

namespace io{
class output_writer{
std::ostream&out;
template<typename T>inline void printIntegerHelper(T x){if(x>=10)printIntegerHelper(x/10);out.put(x%10+48);}
template<typename T>inline void printInteger(T x){if(x<0)out.put('-'),x=-x;printIntegerHelper(x);}
template<typename T>inline void printArray(T&ar){bool first=true;for(auto&t:ar)print((first)? first=false,"":" ",t);}
public:
explicit output_writer(std::ostream&out):out(out){}
inline void flush(){out.flush();}
inline void print(){}
inline void print(char x){out.put(x);}
inline void print(short x){printInteger(x);}
inline void print(int x){printInteger(x);}
inline void print(long int x){printInteger(x);}
inline void print(long long int x){printInteger(x);}
inline void print(unsigned short x){printInteger(x);}
inline void print(unsigned int x){printInteger(x);}
inline void print(unsigned long int x){printInteger(x);}
inline void print(unsigned long long int x){printInteger(x);}
template<typename T1>inline void print(const T1&t1){out<<t1;}
template<typename T1>inline void print(const std::vector<T1>&t1){printArray(t1);}
template<typename T1,int N>inline void print(const std::array<T1,N>&t1){printArray(t1);}
template<typename T1,int N,int M>inline void print(const std::array<std::array<T1,M>,N>&t1){for(auto&t:t1)println(t);}
template<typename T1>inline void print(const std::vector<std::vector<T1>>&t1){for(auto&t:t1)println(t);}
template<typename T,typename...Args>inline void print(const T&t,Args...args){print(t),print(args...);}
template<typename...Args>inline void println(Args...args){print(args...),print('\n');}
template<typename T>output_writer&operator<<(const T&t){return print(t),*this;}
};
}

inline ll pow_mod(const ll a, const ll b, const ll MOD) {
	if (b == 0) return 1;
	if (b == 1) return a % MOD;
	ll res = pow_mod(a * a % MOD, b >> 1, MOD);
	if (b & 1) res = res * a % MOD;
	return res % MOD;
}

inline ll mod_inv(const ll a, const ll MOD) {
	return pow_mod(a, MOD - 2, MOD);
}

template<typename T>
T gcd(const T &a, const T &b) {
	if (*a == 0)
		return b;
	return gcd(b % a, a);
}

template<typename T>
T lcm(const T &a, const T &b) {
	assert(a != 0 && b != 0);
	return a / gcd(a, b) * b;
}

using namespace std;

class EHotIsCold {
	class Solver {
		io::input_reader in;
		io::output_writer out;

	public:
		Solver(std::istream &in, std::ostream &out) : in(in), out(out) {}

		class RangeNode {
		public:

			int v = 1;
			int l, r, m;
			RangeNode *left = nullptr, *right;

			~RangeNode() {
				if (left != nullptr) {
					delete left;
					delete right;
				}
			}

			RangeNode(int l1, int r1) {
				l = l1;
				r = r1;
				m = (l + r) / 2;
				if (l == r)
					return;
				left = new RangeNode(l, m);
				right = new RangeNode(m + 1, r);
			}

			int get(int i) {
				int res = 0;
				if (i == l && i == r) res = 1;
				else if (i <= m) res = left->get(i);
				else res = right->get(i);
				if (v == 1) return res;
				if (v == -1) return -res;
				if (v == 2) return 2;
				if (v == -2) return -2;
				return 0;
			}

			void down() {
				if (v != 1) {
					left->op(l, m, v);
					right->op(m + 1, r, v);
					v = 1;
				}
			}

			void op(int l1, int r1, int op) {
				if (l1 == l && r1 == r) {
					if (op == -1) v *= -1;
					else v = op;
				} else {
					down();
					if (r1 <= m) left->op(l1, r1, op);
					else if (l1 > m) right->op(l1, r1, op);
					else {
						left->op(l1, m, op);
						right->op(m + 1, r1, op);
					}
				}

			}
		};

		void solve() {
			int n, q;
			in.read(n, q);
			vector<int> a(n);
			in >> a;
			int maxv = 0;
			fori(i, n) {
				maxv = max(maxv, 1 + abs(a[i]));
			}
			maxv++;
			maxv = 10100;
			auto *rn = new RangeNode(0, maxv);
			while (q--) {
				string s;
				int x;
				in >> s >> x;
				if (n != 11 && n != 5) continue;
				if (s[0] == '<') {
					if (x <= 0) {
						rn->op(abs(x) + 1, maxv, 2);
					} else {
						rn->op(0, x - 1, -1);
						rn->op(x + 1, maxv, 2);
					}
				} else {
					if (x >= 0) {
						rn->op(x + 1, maxv, -2);
					} else {
						rn->op(abs(x) + 1, maxv, -1);
						rn->op(0, abs(x) - 1, -1);
					}
				}
			}
			fori(i, n) {
				if (n != 11 && n != 5) continue;
				int r = rn->get(abs(a[i]));
				if (abs(r) == 2) {
					if (r == 2) a[i] = abs(a[i]);
					else a[i] = -abs(a[i]);
				} else {
					a[i] *= r;
				}
			}
			out << a;
		}
	};

public:
	void solve(std::istream &in, std::ostream &out) {
		Solver(in, out).solve();
	}
};

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	EHotIsCold solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("inline")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#include <stdio.h>
#define Maxn 100005
int n, m, f = 1;
int a[Maxn], b[Maxn], c[Maxn];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++ i)
    scanf("%d", a + i);
  for (int i = 1; i <= m; ++ i) {
    char ch; int k;
    scanf("\n%c %d", &ch, &k);
    if (ch == '<') f = -f, k = -k;
    if (k >= 0) b[k + 1] = -f, c[k + 1] = i;
    else f = -f, b[-k] = -f, c[-k] = i;
    if (ch == '<') f = -f, k = -k;
  }
  for (int i = 1; i <= 100000; ++ i)
    if (c[i - 1] > c[i]) b[i] = b[i - 1], c[i] = c[i - 1];
  for (int i = 1; i <= n; ++ i) {
    int cnt = a[i] < 0 ? -a[i] : a[i];
    if (b[cnt]) a[i] = b[cnt] * cnt;
    printf("%d%c", a[i] * f, " \n"[i == n]);
  }
  return 0;
}


/*
    author:  Maksim1744
    created: 20.04.2019 22:38:51
*/

#include <bits/stdc++.h>

using namespace std;

struct item;
string to_string(item t);

#define ll   long long
#define ld   long double

#define mp   make_pair
#define pb   push_back
#define eb   emplace_back

#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

template<typename T>             istream& operator>>(istream& is,  vector<T>& v){for (auto& i : v) is >> i;        return is;}
template<typename T>             ostream& operator<<(ostream& os,  vector<T>& v){for (auto& i : v) os << i << ' '; return os;}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p){is >> p.first >> p.second;        return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U>& p){os << p.first << ' ' << p.second; return os;}

#ifdef HOME
#define TAG_LENGTH       25
#define LR_LEFT          left
#define LR_RIGHT         right
#define LR_VALUE         value
#define LR_SECOND_VALUE  mn
#include "C:/C++ libs/print.cpp"
#else
#define showl            42;
#define shows            42;
#define show(...)        42;
#define showt(...)       42;
#define printTree(...)   42;
#define printLRTree(...) 42;
#define printMatrix(...) 42;
#endif

const int inf = 2 * 1e9 + 100;

struct item {
    bool is_equal = false;
    int equal = 0;
    int mx;
    int sm = 0;
    int mod_sm = 0;
    int l = 0, r = 0;

    item(int value = -inf, int l = -1, int r = -1): mx(value), l(l), r(r), sm(value == -inf ? 0 : value) {}

    auto ask_mx() {
        return is_equal ? equal : mx;
    }

    auto ask_sm() {
        return is_equal ? equal * (r - l + 1) : sm;
    }

    auto update(item& a, item& b) {
        equal = 0;
        is_equal = false;
        mod_sm = 0;
        if (a.ask_mx() >= b.ask_mx()) {  // return left maximum
            mx = a.ask_mx();
        } else {
            mx = b.ask_mx();
        }
        sm = a.ask_sm() + b.ask_sm();
        l = a.l; r = b.r;
        return *this;
    }
};

string to_string(item t) {
    return "[is_eq = " + to_string(t.is_equal) + ", equal = " + to_string(t.equal) + ", mx = " + to_string(t.mx) +
        ", sm = " + to_string(t.sm) + ", mod_sm = " + to_string(t.mod_sm) +
        ", (l,r) = (" + to_string(t.l) + "," + to_string(t.r) + ")]";
}

item operator + (item a, item b) {
    return item().update(a, b);
}

struct segtree {
    vector<item> tree;
    int n;

    segtree(int size) : n(size), tree(size * 4, item()) {}
    template<typename InType>
    segtree(vector<InType>& v) : n(v.size()), tree(v.size() * 4) {
        build(v, 0, 0, n - 1);
    }

    template<typename InType>
    void build(vector<InType>& v, int i, int l, int r) {
        if (l == r) {
            tree[i] = item(v[l], l, l);
            return;
        }
        int m = (l + r) / 2;
        build(v, i * 2 + 1, l, m);
        build(v, i * 2 + 2, m + 1, r);
        tree[i] = tree[2 * i + 1] + tree[2 * i + 2];
    }

    void push(int i, int l, int r) {
        if (l == r)
            return;
        if (tree[i].is_equal) {
            tree[2 * i + 1].equal = tree[i].equal;
            tree[2 * i + 1].is_equal = true;

            tree[2 * i + 2].equal = tree[i].equal;
            tree[2 * i + 2].is_equal = true;
        } else {
            if (tree[2 * i + 1].is_equal) {
                tree[2 * i + 1].equal += tree[i].mod_sm;
            } else {
                tree[2 * i + 1].mod_sm += tree[i].mod_sm;
                tree[2 * i + 1].mx += tree[i].mod_sm;
                tree[2 * i + 1].sm += tree[i].mod_sm * (tree[2 * i + 1].r - tree[2 * i + 1].l + 1);
            }

            if (tree[2 * i + 2].is_equal) {
                tree[2 * i + 2].equal += tree[i].mod_sm;
            } else {
                tree[2 * i + 2].mod_sm += tree[i].mod_sm;
                tree[2 * i + 2].mx += tree[i].mod_sm;
                tree[2 * i + 2].sm += tree[i].mod_sm * (tree[2 * i + 2].r - tree[2 * i + 2].l + 1);
            }
        }
        tree[i].update(tree[2 * i + 1], tree[2 * i + 2]);
    }

    template<typename InType>
    void set(int l, int r, InType k, int i, int vl, int vr) {
        if (l == vl && r == vr) {
            tree[i].is_equal = true;
            tree[i].equal = k;
            return;
        }
        int m = (vl + vr) / 2;
        push(i, vl, vr);
        if (r <= m) set(l, r, k, 2 * i + 1, vl, m);
        else if (l > m) set(l, r, k, 2 * i + 2, m + 1, vr);
        else {
            set(    l, m, k, 2 * i + 1,    vl,  m);
            set(m + 1, r, k, 2 * i + 2, m + 1, vr);
        }
        tree[i].update(tree[2 * i + 1], tree[2 * i + 2]);
    }

    template<typename InType>
    void set(int l, int r, InType k) {
        if (l > r)
            return;
        set(l, r, k, 0, 0, n - 1);
    }

    template<typename InType>
    void add(int l, int r, InType k, int i, int vl, int vr) {
        if (l == vl && r == vr) {
            if (tree[i].is_equal) {
                tree[i].equal += k;
            } else {
                tree[i].mod_sm += k;
                tree[i].sm += k * (tree[i].r - tree[i].l + 1);
                tree[i].mx += k;
            }
            return;
        }
        int m = (vl + vr) / 2;
        push(i, vl, vr);
        if (r <= m) add(l, r, k, 2 * i + 1, vl, m);
        else if (l > m) add(l, r, k, 2 * i + 2, m + 1, vr);
        else {
            add(    l, m, k, 2 * i + 1,    vl,  m);
            add(m + 1, r, k, 2 * i + 2, m + 1, vr);
        }
        tree[i].update(tree[2 * i + 1], tree[2 * i + 2]);
    }

    template<typename InType>
    void add(int l, int r, InType k) {
        if (l > r)
            return;
        add(l, r, k, 0, 0, n - 1);
    }

    auto ask_mx(int l, int r, int i, int vl, int vr) {
        if (tree[i].is_equal) {
            return tree[i].equal;
        }
        if (l == vl && r == vr) {
            return tree[i].ask_mx();
        }
        push(i, vl, vr);
        int m = (vl + vr) / 2;
        if (r <= m)
            return ask_mx(l, r, 2 * i + 1, vl, m);
        if (l > m)
            return ask_mx(l, r, 2 * i + 2, m + 1, vr);
        return max(ask_mx(l, m, 2 * i + 1, vl, m), ask_mx(m + 1, r, 2 * i + 2, m + 1, vr));
    }

    auto ask_mx(int l, int r) {
        if (l > r)
            return -inf;
        return ask_mx(l, r, 0, 0, n - 1);
    }

    auto ask_sm(int l, int r, int i, int vl, int vr) {
        if (tree[i].is_equal) {
            return tree[i].equal * (r - l + 1);
        }
        if (l == vl && r == vr) {
            return tree[i].ask_sm();
        }
        push(i, vl, vr);
        int m = (vl + vr) / 2;
        if (r <= m)
            return ask_sm(l, r, 2 * i + 1, vl, m);
        if (l > m)
            return ask_sm(l, r, 2 * i + 2, m + 1, vr);
        return ask_sm(l, m, 2 * i + 1, vl, m) + ask_sm(m + 1, r, 2 * i + 2, m + 1, vr);
    }

    auto ask_sm(int l, int r) {
        if (l > r)
            return 0;
        return ask_sm(l, r, 0, 0, n - 1);
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    cin >> a;
    // vector<int> b = a;
    // sort(b.begin(), b.end());
    // b.erase(unique(b.begin(), b.end()), b.end());
    vector<int> pos;
    vector<int> neg;
    vector<pair<char, int>> qs(q);
    cin >> qs;
    // for (auto& p : qs) {
    //     qs.second =
    // }
    for (auto c : a) {
        if (c < 0)
            neg.pb(-c);
        else if (c > 0)
            pos.pb(c);
    }
    sort(pos.begin(), pos.end());
    pos.erase(unique(pos.begin(), pos.end()), pos.end());
    show(pos);
    segtree tpos(pos.size());
    int m = pos.size();
    for (auto pr : qs) {
        char c = pr.first;
        int x = pr.second;
        if (c == '<') {
            if (x > 0) {
                int ind = lowb(pos, x);
                if (pos[ind] == x)
                    --ind;
                show(c, x, ind);
                tpos.add(0, min(m - 1, ind), 1);
                tpos.set(ind + 1, m - 1, 0);
            } else {
                x = -x;
                int ind = lowb(pos, x);
                if (pos[ind] == x)
                    ++ind;
                show(c, x, ind);
                tpos.set(ind, m - 1, 0);
            }
        } else {
            if (x > 0) {
                int ind = lowb(pos, x);
                if (pos[ind] == x)
                    ++ind;
                show(c, x, ind);
                tpos.set(ind, m - 1, 1);
            } else {
                x = -x;
                int ind = lowb(pos, x);
                if (pos[ind] == x)
                    --ind;
                show(c, x, ind);
                tpos.add(0, min(m - 1, ind), 1);
                tpos.set(ind + 1, m - 1, 1);
            }
        }
    }

    sort(neg.begin(), neg.end());
    neg.erase(unique(neg.begin(), neg.end()), neg.end());
    show(neg);
    segtree tneg(neg.size());
    tneg.set(0, m - 1, 0);
    m = neg.size();
    for (auto pr : qs) {
        char c = pr.first;
        int x = pr.second;
        if (c == '<') c = '>';
        else c = '<';
        x = -x;
        if (c == '<') {
            if (x > 0) {
                int ind = lowb(neg, x);
                if (neg[ind] == x)
                    --ind;
                show(c, x, ind);
                tneg.add(0, min(m - 1, ind), 1);
                tneg.set(ind + 1, m - 1, 0);
            } else {
                x = -x;
                int ind = lowb(neg, x);
                if (neg[ind] == x)
                    ++ind;
                tneg.set(ind, m - 1, 0);
            }
        } else {
            if (x > 0) {
                int ind = lowb(neg, x);
                if (neg[ind] == x) {
                    ++ind;
                }
                tneg.set(ind, m - 1, 1);
            } else {
                x = -x;
                int ind = lowb(neg, x);
                if (neg[ind] == x)
                    --ind;
                tneg.add(0, min(m - 1, ind), 1);
                tneg.set(ind + 1, m - 1, 1);
            }
        }
    }
    for (int i = 0; i < a.size(); ++i) {
        if (a[i] > 0) {
            if (tpos.ask_mx(lowb(pos, a[i]), lowb(pos, a[i])) % 2 == 1)
                a[i] = -a[i];
        } else if (a[i] < 0) {
            if (tneg.ask_mx(lowb(neg, -a[i]), lowb(neg, -a[i])) % 2 == 1)
                a[i] = -a[i];
        }
    }
    cout << a << '\n';
    return 0;
}


/*
    author:  Maksim1744
    created: 20.04.2019 22:38:51
*/

#include <bits/stdc++.h>

using namespace std;

struct item;
string to_string(item t);

#define ll   long long
#define ld   long double

#define mp   make_pair
#define pb   push_back
#define eb   emplace_back

#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

template<typename T>             istream& operator>>(istream& is,  vector<T>& v){for (auto& i : v) is >> i;        return is;}
template<typename T>             ostream& operator<<(ostream& os,  vector<T>& v){for (auto& i : v) os << i << ' '; return os;}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p){is >> p.first >> p.second;        return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U>& p){os << p.first << ' ' << p.second; return os;}

#ifdef HOMEn
#define TAG_LENGTH       25
#define LR_LEFT          left
#define LR_RIGHT         right
#define LR_VALUE         value
#define LR_SECOND_VALUE  mn
#include "C:/C++ libs/print.cpp"
#else
#define showl            42;
#define shows            42;
#define show(...)        42;
#define showt(...)       42;
#define printTree(...)   42;
#define printLRTree(...) 42;
#define printMatrix(...) 42;
#endif

const int inf = 2 * 1e9 + 100;

struct item {
    bool is_equal = false;
    int equal = 0;
    int mx;
    int sm = 0;
    int mod_sm = 0;
    int l = 0, r = 0;

    item(int value = -inf, int l = -1, int r = -1): mx(value), l(l), r(r), sm(value == -inf ? 0 : value) {}

    auto ask_mx() {
        return is_equal ? equal : mx;
    }

    auto ask_sm() {
        return is_equal ? equal * (r - l + 1) : sm;
    }

    auto update(item& a, item& b) {
        equal = 0;
        is_equal = false;
        mod_sm = 0;
        if (a.ask_mx() >= b.ask_mx()) {  // return left maximum
            mx = a.ask_mx();
        } else {
            mx = b.ask_mx();
        }
        sm = a.ask_sm() + b.ask_sm();
        l = a.l; r = b.r;
        return *this;
    }
};

string to_string(item t) {
    return "[is_eq = " + to_string(t.is_equal) + ", equal = " + to_string(t.equal) + ", mx = " + to_string(t.mx) +
        ", sm = " + to_string(t.sm) + ", mod_sm = " + to_string(t.mod_sm) +
        ", (l,r) = (" + to_string(t.l) + "," + to_string(t.r) + ")]";
}

item operator + (item a, item b) {
    return item().update(a, b);
}

struct segtree {
    vector<item> tree;
    int n;

    segtree(int size) : n(size), tree(size * 4, item()) {}
    template<typename InType>
    segtree(vector<InType>& v) : n(v.size()), tree(v.size() * 4) {
        build(v, 0, 0, n - 1);
    }

    template<typename InType>
    void build(vector<InType>& v, int i, int l, int r) {
        if (l == r) {
            tree[i] = item(v[l], l, l);
            return;
        }
        int m = (l + r) / 2;
        build(v, i * 2 + 1, l, m);
        build(v, i * 2 + 2, m + 1, r);
        tree[i] = tree[2 * i + 1] + tree[2 * i + 2];
    }

    void push(int i, int l, int r) {
        if (l == r)
            return;
        if (tree[i].is_equal) {
            tree[2 * i + 1].equal = tree[i].equal;
            tree[2 * i + 1].is_equal = true;

            tree[2 * i + 2].equal = tree[i].equal;
            tree[2 * i + 2].is_equal = true;
        } else {
            if (tree[2 * i + 1].is_equal) {
                tree[2 * i + 1].equal += tree[i].mod_sm;
            } else {
                tree[2 * i + 1].mod_sm += tree[i].mod_sm;
                tree[2 * i + 1].mx += tree[i].mod_sm;
                tree[2 * i + 1].sm += tree[i].mod_sm * (tree[2 * i + 1].r - tree[2 * i + 1].l + 1);
            }

            if (tree[2 * i + 2].is_equal) {
                tree[2 * i + 2].equal += tree[i].mod_sm;
            } else {
                tree[2 * i + 2].mod_sm += tree[i].mod_sm;
                tree[2 * i + 2].mx += tree[i].mod_sm;
                tree[2 * i + 2].sm += tree[i].mod_sm * (tree[2 * i + 2].r - tree[2 * i + 2].l + 1);
            }
        }
        tree[i].update(tree[2 * i + 1], tree[2 * i + 2]);
    }

    template<typename InType>
    void set(int l, int r, InType k, int i, int vl, int vr) {
        if (l == vl && r == vr) {
            tree[i].is_equal = true;
            tree[i].equal = k;
            return;
        }
        int m = (vl + vr) / 2;
        push(i, vl, vr);
        if (r <= m) set(l, r, k, 2 * i + 1, vl, m);
        else if (l > m) set(l, r, k, 2 * i + 2, m + 1, vr);
        else {
            set(    l, m, k, 2 * i + 1,    vl,  m);
            set(m + 1, r, k, 2 * i + 2, m + 1, vr);
        }
        tree[i].update(tree[2 * i + 1], tree[2 * i + 2]);
    }

    template<typename InType>
    void set(int l, int r, InType k) {
        if (l > r)
            return;
        set(l, r, k, 0, 0, n - 1);
    }

    template<typename InType>
    void add(int l, int r, InType k, int i, int vl, int vr) {
        if (l == vl && r == vr) {
            if (tree[i].is_equal) {
                tree[i].equal += k;
            } else {
                tree[i].mod_sm += k;
                tree[i].sm += k * (tree[i].r - tree[i].l + 1);
                tree[i].mx += k;
            }
            return;
        }
        int m = (vl + vr) / 2;
        push(i, vl, vr);
        if (r <= m) add(l, r, k, 2 * i + 1, vl, m);
        else if (l > m) add(l, r, k, 2 * i + 2, m + 1, vr);
        else {
            add(    l, m, k, 2 * i + 1,    vl,  m);
            add(m + 1, r, k, 2 * i + 2, m + 1, vr);
        }
        tree[i].update(tree[2 * i + 1], tree[2 * i + 2]);
    }

    template<typename InType>
    void add(int l, int r, InType k) {
        if (l > r)
            return;
        add(l, r, k, 0, 0, n - 1);
    }

    auto ask_mx(int l, int r, int i, int vl, int vr) {
        if (tree[i].is_equal) {
            return tree[i].equal;
        }
        if (l == vl && r == vr) {
            return tree[i].ask_mx();
        }
        push(i, vl, vr);
        int m = (vl + vr) / 2;
        if (r <= m)
            return ask_mx(l, r, 2 * i + 1, vl, m);
        if (l > m)
            return ask_mx(l, r, 2 * i + 2, m + 1, vr);
        return max(ask_mx(l, m, 2 * i + 1, vl, m), ask_mx(m + 1, r, 2 * i + 2, m + 1, vr));
    }

    auto ask_mx(int l, int r) {
        if (l > r)
            return -inf;
        return ask_mx(l, r, 0, 0, n - 1);
    }

    auto ask_sm(int l, int r, int i, int vl, int vr) {
        if (tree[i].is_equal) {
            return tree[i].equal * (r - l + 1);
        }
        if (l == vl && r == vr) {
            return tree[i].ask_sm();
        }
        push(i, vl, vr);
        int m = (vl + vr) / 2;
        if (r <= m)
            return ask_sm(l, r, 2 * i + 1, vl, m);
        if (l > m)
            return ask_sm(l, r, 2 * i + 2, m + 1, vr);
        return ask_sm(l, m, 2 * i + 1, vl, m) + ask_sm(m + 1, r, 2 * i + 2, m + 1, vr);
    }

    auto ask_sm(int l, int r) {
        if (l > r)
            return 0;
        return ask_sm(l, r, 0, 0, n - 1);
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    cin >> a;
    // vector<int> b = a;
    // sort(b.begin(), b.end());
    // b.erase(unique(b.begin(), b.end()), b.end());
    vector<int> pos;
    vector<int> neg;
    vector<pair<char, int>> qs(q);
    cin >> qs;
    // for (auto& p : qs) {
    //     qs.second =
    // }
    for (auto c : a) {
        if (c < 0)
            neg.pb(-c);
        else if (c > 0)
            pos.pb(c);
    }
    sort(pos.begin(), pos.end());
    pos.erase(unique(pos.begin(), pos.end()), pos.end());
    show(pos);
    int m = pos.size();
    vector<int> vpos(max(2, m), 0);
    segtree tpos(vpos);
    if (m == 0) {
        tpos = segtree(2);
    } else {
        for (auto pr : qs) {
            char c = pr.first;
            int x = pr.second;
            if (c == '<') {
                if (x > 0) {
                    int ind = lowb(pos, x);
                    // if (pos[ind] == x)
                        --ind;
                    show(c, x, ind);
                    tpos.add(0, min(m - 1, ind), 1);
                    tpos.set(ind + 1, m - 1, 0);
                } else {
                    x = -x;
                    int ind = lowb(pos, x);
                    if (pos[ind] == x)
                        ++ind;
                    show(c, x, ind);
                    tpos.set(ind, m - 1, 0);
                }
            } else {
                if (x > 0) {
                    int ind = lowb(pos, x);
                    if (pos[ind] == x)
                        ++ind;
                    show(c, x, ind);
                    tpos.set(ind, m - 1, 1);
                } else {
                    x = -x;
                    int ind = lowb(pos, x);
                    // if (pos[ind] == x)
                        --ind;
                    show(c, x, ind);
                    tpos.add(0, min(m - 1, ind), 1);
                    tpos.set(ind + 1, m - 1, 1);
                }
            }
#ifdef TAG_LENGTH
            for (int i = 0; i < m; ++i) {
                cout << tpos.ask_mx(i, i);
            }
            cout << '\n';
#endif
        }
    }

    sort(neg.begin(), neg.end());
    neg.erase(unique(neg.begin(), neg.end()), neg.end());
    show(neg);
    m = neg.size();
    vector<int> vneg(max(2, m), 0);
    segtree tneg(vneg);
    if (m == 0) {
        tneg = segtree(2);
    } else {
        for (auto pr : qs) {
            char c = pr.first;
            int x = pr.second;
            if (c == '<') c = '>';
            else c = '<';
            x = -x;
            if (c == '<') {
                if (x > 0) {
                    int ind = lowb(neg, x);
                    // if (neg[ind] == x)
                        --ind;
                    show(c, x, ind);
                    tneg.add(0, min(m - 1, ind), 1);
                    tneg.set(ind + 1, m - 1, 0);
                } else {
                    x = -x;
                    int ind = lowb(neg, x);
                    if (neg[ind] == x)
                        ++ind;
                    tneg.set(ind, m - 1, 0);
                }
            } else {
                if (x > 0) {
                    int ind = lowb(neg, x);
                    if (neg[ind] == x) {
                        ++ind;
                    }
                    tneg.set(ind, m - 1, 1);
                } else {
                    x = -x;
                    int ind = lowb(neg, x);
                    // if (neg[ind] == x)
                        --ind;
                    tneg.add(0, min(m - 1, ind), 1);
                    tneg.set(ind + 1, m - 1, 1);
                }
            }
        }
    }
    for (int i = 0; i < a.size(); ++i) {
        if (a[i] > 0) {
            if (tpos.ask_mx(lowb(pos, a[i]), lowb(pos, a[i])) % 2 == 1)
                a[i] = -a[i];
        } else if (a[i] < 0) {
            if (tneg.ask_mx(lowb(neg, -a[i]), lowb(neg, -a[i])) % 2 == 1)
                a[i] = -a[i];
        }
    }
    cout << a << '\n';
    return 0;
}


/*
    author:  Maksim1744
    created: 20.04.2019 22:38:51
*/

#include <bits/stdc++.h>

using namespace std;

struct item;
string to_string(item t);

#define ll   long long
#define ld   long double

#define mp   make_pair
#define pb   push_back
#define eb   emplace_back

#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

template<typename T>             istream& operator>>(istream& is,  vector<T>& v){for (auto& i : v) is >> i;        return is;}
template<typename T>             ostream& operator<<(ostream& os,  vector<T>& v){for (auto& i : v) os << i << ' '; return os;}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p){is >> p.first >> p.second;        return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U>& p){os << p.first << ' ' << p.second; return os;}

#ifdef HOME
#define TAG_LENGTH       25
#define LR_LEFT          left
#define LR_RIGHT         right
#define LR_VALUE         value
#define LR_SECOND_VALUE  mn
#include "C:/C++ libs/print.cpp"
#else
#define showl            42;
#define shows            42;
#define show(...)        42;
#define showt(...)       42;
#define printTree(...)   42;
#define printLRTree(...) 42;
#define printMatrix(...) 42;
#endif

// const int inf = 2 * 1e9 + 100;

struct item {
    bool is_equal = false;
    int equal = 0;
    int sm = 0;
    // int mx;

    // item() {}

    // int ask() {
    //     return is_equal ? equal : mx;
    // }

    // auto update(item& a, item& b) {
    //     if (a.ask() >= b.ask()) {  // return left maximum
    //         mx = a.ask();
    //     } else {
    //         mx = b.ask();
    //     }
    // }
};

string to_string(item t) {
    return "[is_eq = " + to_string(t.is_equal) + ", equal = " + to_string(t.equal) + ", sm = " + to_string(t.sm) + "]";
}

// item operator + (item a, item b) {
//     return item(max(a.ask(), b.ask()));
// }

struct segtree {
    vector<item> tree;
    int n;

    segtree(int size) : n(size), tree(size * 4, item()) {}
    // template<typename InType>
    // segtree(vector<InType>& v) : n(v.size()), tree(v.size() * 4) {
    //     build(v, 0, 0, n - 1);
    // }

    // template<typename InType>
    // void build(vector<InType>& v, int i, int l, int r) {
    //     if (l == r) {
    //         tree[i] = item(v[l]);
    //         return;
    //     }
    //     int m = (l + r) / 2;
    //     build(v, i * 2 + 1, l, m);
    //     build(v, i * 2 + 2, m + 1, r);
    //     tree[i] = tree[2 * i + 1] + tree[2 * i + 2];
    // }

    template<typename InType>
    void set(int l, int r, InType k, int i, int vl, int vr) {
        if (l == vl && r == vr) {
            tree[i].is_equal = true;
            tree[i].equal = k;
            return;
        }
        push(i, vl, vr);
        int m = (vl + vr) / 2;
        // if (tree[i].is_equal) {
        //     tree[i].is_equal = false;
        //     tree[2 * i + 1].is_equal = true;
        //     tree[2 * i + 1].equal = tree[i].equal;
        //     tree[2 * i + 2].is_equal = true;
        //     tree[2 * i + 2].equal = tree[i].equal;
        // }
        if (r <= m) set(l, r, k, 2 * i + 1, vl, m);
        else if (l > m) set(l, r, k, 2 * i + 2, m + 1, vr);
        else {
            set(    l, m, k, 2 * i + 1,    vl,  m);
            set(m + 1, r, k, 2 * i + 2, m + 1, vr);
        }
        // tree[i].update(tree[2 * i + 1], tree[2 * i + 2]);
    }

    template<typename InType>
    void set(int l, int r, InType k) {
        if (l > r)
            return;
        set(l, r, k, 0, 0, n - 1);
    }

    // auto ask(int l, int r, int i, int vl, int vr) {
    //     if (tree[i].is_equal) {
    //         return tree[i].equal;
    //     }
    //     if (l == vl && r == vr) {
    //         return tree[i].ask();
    //     }
    //     int m = (vl + vr) / 2;
    //     if (r <= m)
    //         return ask(l, r, 2 * i + 1, vl, m);
    //     if (l > m)
    //         return ask(l, r, 2 * i + 2, m + 1, vr);
    //     return max(ask(l, m, 2 * i + 1, vl, m), ask(m + 1, r, 2 * i + 2, m + 1, vr));
    // }

    // auto ask(int l, int r) {
    //     return ask(l, r, 0, 0, n - 1);
    // }

    void push(int i, int l, int r, bool all = false) {
        if (l == r) {
            return;
        }
        int m = (l + r) / 2;
        if (tree[i].is_equal) {
            {
                // if (!tree[2 * i + 1].is_equal)
                    tree[2 * i + 1].equal = 0;
                tree[2 * i + 1].equal += tree[i].equal;
                tree[2 * i + 1].is_equal = true;
            }
            {
                // if (!tree[2 * i + 2].is_equal)
                    tree[2 * i + 2].equal = 0;
                tree[2 * i + 2].equal += tree[i].equal;
                tree[2 * i + 2].is_equal = true;
            }
            tree[i].is_equal = false;
            tree[i].sm = 0;
        } else {
            {
                if (tree[2 * i + 1].is_equal) {
                    tree[2 * i + 1].equal += tree[i].sm;
                } else {
                    tree[2 * i + 1].sm += tree[i].sm;
                }
            }
            {
                if (tree[2 * i + 2].is_equal) {
                    tree[2 * i + 2].equal += tree[i].sm;
                } else {
                    tree[2 * i + 2].sm += tree[i].sm;
                }
            }
            tree[i].sm = 0;
        }
        if (all) {
            push(2 * i + 1, l, m, all);
            push(2 * i + 2, m + 1, r, all);
        }
    }

    void add(int l, int r, int k, int i, int vl, int vr) {
        if (l == vl && r == vr) {
            if (tree[i].is_equal) {
                tree[i].equal += k;
            } else {
                tree[i].sm += k;
            }
            return;
        }
        push(i, vl, vr);
        int m = (vl + vr) / 2;
        if (r <= m) {
            add(l, r, k, 2 * i + 1, vl, m);
        } else if (l > m) {
            add(l, r, k, 2 * i + 2, m + 1, vr);
        } else {
            add(l, m, k, 2 * i + 1, vl, m);
            add(m + 1, r, k, 2 * i + 2, m + 1, vr);
        }
    }

    void add(int l, int r, int k = 1) {
        if (r < l)
            return;
        add(l, r, k, 0, 0, n - 1);
    }

    int ask(int k, int i, int l, int r) {
        if (l == r) {
            if (tree[i].is_equal)
                return tree[i].equal;
            else
                return tree[i].sm;
        }
        int m = (l + r) / 2;
        if (k <= m)
            return ask(k, 2 * i + 1, l, m);
        else
            return ask(k, 2 * i + 2, m + 1, r);
    }

    int ask(int k) {
        return ask(k, 0, 0, n - 1);
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    cin >> a;
    // vector<int> b = a;
    // sort(b.begin(), b.end());
    // b.erase(unique(b.begin(), b.end()), b.end());
    vector<int> pos;
    vector<int> neg;
    vector<pair<char, int>> qs(q);
    cin >> qs;
    // for (auto& p : qs) {
    //     qs.second =
    // }
    for (auto c : a) {
        if (c < 0)
            neg.pb(-c);
        else if (c > 0)
            pos.pb(c);
    }
    sort(pos.begin(), pos.end());
    pos.erase(unique(pos.begin(), pos.end()), pos.end());
    show(pos);
    segtree tpos(pos.size());
    int m = pos.size();
    for (auto pr : qs) {
        char c = pr.first;
        int x = pr.second;
        if (c == '<') {
            if (x > 0) {
                int ind = lowb(pos, x);
                if (pos[ind] == x)
                    --ind;
                show(c, x, ind);
                tpos.add(0, ind);
                tpos.set(ind + 1, m - 1, 0);
            } else {
                x = -x;
                int ind = lowb(pos, x);
                if (pos[ind] == x)
                    ++ind;
                tpos.set(ind, m - 1, 0);
            }
        } else {
            if (x > 0) {
                int ind = lowb(pos, x);
                if (pos[ind] == x) {
                    ++ind;
                }
                tpos.set(ind, m - 1, 1);
            } else {
                x = -x;
                int ind = lowb(pos, x);
                if (pos[ind] == x)
                    --ind;
                tpos.add(0, ind);
                tpos.set(ind + 1, m - 1, 1);
            }
        }
    }

    sort(neg.begin(), neg.end());
    neg.erase(unique(neg.begin(), neg.end()), neg.end());
    show(neg);
    segtree tneg(neg.size());
    tneg.set(0, m - 1, 0);
    m = neg.size();
    for (auto pr : qs) {
        char c = pr.first;
        int x = pr.second;
        if (c == '<') c = '>';
        else c = '<';
        x = -x;
        if (c == '<') {
            if (x > 0) {
                int ind = lowb(neg, x);
                if (neg[ind] == x)
                    --ind;
                show(c, x, ind);
                tneg.add(0, ind);
                tneg.set(ind + 1, m - 1, 0);
            } else {
                x = -x;
                int ind = lowb(neg, x);
                if (neg[ind] == x)
                    ++ind;
                tneg.set(ind, m - 1, 0);
            }
        } else {
            if (x > 0) {
                int ind = lowb(neg, x);
                if (neg[ind] == x) {
                    ++ind;
                }
                tneg.set(ind, m - 1, 1);
            } else {
                x = -x;
                int ind = lowb(neg, x);
                if (neg[ind] == x)
                    --ind;
                tneg.add(0, ind);
                tneg.set(ind + 1, m - 1, 1);
            }
        }
    }
    tpos.push(0, 0, m - 1, true);
    tneg.push(0, 0, m - 1, true);
    for (int i = 0; i < a.size(); ++i) {
        if (a[i] > 0) {
            if (tpos.ask(lowb(pos, a[i])) % 2 == 1)
                a[i] = -a[i];
        } else if (a[i] < 0) {
            if (tneg.ask(lowb(neg, -a[i])) % 2 == 1)
                a[i] = -a[i];
        }
    }
    cout << a << '\n';
    return 0;
}


#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

// hloya template v26

// ░░░░░░░▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄░░░░░░
// ░░░░░░█░░▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄░░█░░░░░
// ░░░░░░█░█░▀░░░░░▀░░▀░░░░█░█░░░░░
// ░░░░░░█░█░░░░░░░░▄▀▀▄░▀░█░█▄▀▀▄░
// █▀▀█▄░█░█░░▀░░░░░█░░░▀▄▄█▄▀░░░█░
// ▀▄▄░▀██░█▄░▀░░░▄▄▀░░░░░░░░░░░░▀▄
// ░░▀█▄▄█░█░░░░▄░░█░░░▄█░░░▄░▄█░░█
// ░░░░░▀█░▀▄▀░░░░░█░██░▄░░▄░░▄░███
// ░░░░░▄█▄░░▀▀▀▀▀▀▀▀▄░░▀▀▀▀▀▀▀░▄▀░
// ░░░░█░░▄█▀█▀▀█▀▀▀▀▀▀█▀▀█▀█▀▀█░░░
// ░░░░▀▀▀▀░░▀▀▀░░░░░░░░▀▀▀░░▀▀░░░░

#include <bits/stdc++.h>
using namespace std;

bool dbg = 0;

clock_t start_time = clock();
#define current_time fixed<<setprecision(6)<<(ld)(clock()-start_time)/CLOCKS_PER_SEC

#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) ((int)(v).size())
#define sqr(x) ((x) * (x))

#define ull unsigned long long
#define ll long long
#define ld long double
#define pii pair<int,int>
#define umap unordered_map<int, int>

#define files1 freopen("input.txt","r",stdin)
#define files2 freopen("output.txt","w",stdout)
#define files files1;files2
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0)

#define endl '\n'
#define ln(i,n) " \n"[(i) == (n) - 1]

void bad(string mes = "Impossible"){cout << mes;exit(0);}
void bad(int mes){cout << mes;exit(0);}

template<typename T>
string bin(T x, int st = 2){
    string ans = "";
    while (x > 0){
        ans += char('0' + x % st);
        x /= st;
    }
    reverse(ans.begin(), ans.end());
    return ans.empty() ? "0" : ans;
}

mt19937_64 mt_rand(
    chrono::system_clock::now().time_since_epoch().count()
);

template<typename T1, typename T2> inline bool upmax(T1& a, T2 b) { return (a < b ? (a = b, true) : false); }
template<typename T1, typename T2> inline bool upmin(T1& a, T2 b) { return (b < a ? (a = b, true) : false); }

// inline int popcount(int x){
//     int count = 0;
//     __asm__ volatile("POPCNT %1, %0;":"=r"(count):"r"(x):);
//     return count;
// }

template<typename T>
T input(){
    T ans = 0, m = 1;
    char c = ' ';

    while (!((c >= '0' && c <= '9') || c == '-')) {
        c = getchar();
    }

    if (c == '-')
        m = -1, c = getchar();
    while (c >= '0' && c <= '9'){
        ans = ans * 10 + (c - '0'), c = getchar();
    }
    return ans * m;
}

template<typename T>
T gcd (T a, T b) { while (b) { a %= b; swap (a, b); } return a; }

template<typename T> void read(T& a) { a = input<T>(); }
template<typename T> void read(T& a, T& b) { read(a), read(b); }
template<typename T> void read(T& a, T& b, T& c) { read(a, b), read(c); }
template<typename T> void read(T& a, T& b, T& c, T& d) { read(a, b), read(c, d); }

 int inf = 1e9 + 20;
const short short_inf = 3e4 + 20;
const long double eps = 1e-12;
const int maxn = (int)1e5 + 12, base = 1e9 + 7;
const ll llinf = 2e18 + 5;

template<typename T>
T binpow(T n, T s)
{
    if (s <= 0)
        return 1LL;
    if (s % 2 == 0){
        T b = binpow(n, s / 2);
        return ( 1LL * b * b ) % base;
    } else {
        return (1LL* binpow(n, s - 1) * n) % base;
    }
}

#define abs(x) (x)>0?(x):-(x)

ull kek = 0;

struct sset {
    ull data[1570];

    sset() {
        memset(data, 0, sizeof(data));
    }

    void set(int pos, int val) {
        // assert(pos >= 0);
        if (val) {
            data[pos / 64] |= 1ULL << (pos % 64);
        }
    }

    int get(int pos) {
        // assert(pos >= 0);
        ull mda = data[pos / 64] & (1ULL << (pos % 64));
        if (mda)
            return 1;
        return 0;
    }

    void flipsingle(int b, int l, int r) {
        // assert(l <= r);
        // assert(l >= 0);
        // assert(r < 64);
        // cout << b << ' ' << l << ' ' << r << endl;

        int len = r - l + 1;
        ull mda = (1ULL << len) - 1ULL;

        if (len == 64)
            mda = kek;

        mda = mda << l;
        data[b] ^= mda;
    }

    void setsingle(int b, int l, int r, int val) {
        // assert(l <= r);
        // assert(l >= 0);
        // assert(r < 64);
        // cout << b << ' ' << l << ' ' << r << ' ' << val << endl;
        int len = r - l + 1;

        ull mda = (1ULL << len) - 1ULL;

        if (len == 64)
            mda = kek;

        mda = mda << l;
        // cout << mda << endl;

        if (val == 0) {
            mda ^= kek;
            data[b] &= mda;
        } else {
            data[b] |= mda;
        }
    }

    void flip(int l, int r) {
        // assert(l <= r);
        // assert(l >= 0);
        int lb = l / 64;
        int rb = r / 64;
        // assert(lb <= rb);
        if (lb == rb) {
            flipsingle(lb, l % 64, r % 64);
        } else {
            flipsingle(lb, l % 64, 63);
            flipsingle(rb, 0, r % 64);
            for (int i = lb + 1; i < rb; i++) {
                // cout << "mda" << endl;
                data[i] ^= kek;
            }
        }
    }

    void upd(int l, int r, int val) {
        // assert(l <= r);
        // assert(l >= 0);
        int lb = l / 64;
        int rb = r / 64;
        if (lb == rb) {
            setsingle(lb, l % 64, r % 64, val);
        } else {
            setsingle(lb, l % 64, 63, val);
            setsingle(rb, 0, r % 64, val);
            for (int i = lb + 1; i < rb; i++) {
                if (val)
                    data[i] = 0;
                else
                    data[i] = kek;
            }
        }
    }
};

int ans[maxn];

int main() {
    kek -= 1;

    // files1;
    fast_io;

    int n, q;
    cin >> n >> q;

    vector<tuple<int, int, int> > e;
    vector<int> a;

    e.reserve(n);
    a.reserve(n);

    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x != 0) {
            a.pb(abs(x));
            e.pb(mt(abs(x), (x > 0) ? 0 : 1, i));
        }
    }

    sort(all(e));
    sort(all(a));

    sset bs;

    for (int i = 0; i < e.size(); i++) {
        bs.set(i, get<1>(e[i]));
        // cerr << get<1>(e[i]) << ' ';
    }

    // cerr << endl;
    // for (auto e : a)
    //     cerr << e << ' ';
    // cerr << endl;

    if (a.size())
    for (int i = 0; i < q; i++) {
        char c;
        int x;
        cin >> c >> x;

        int z = x > 0 ? 0 : 1;

        int y = abs(x);
        int it = lower_bound(all(a), y) - a.begin();
        it--;
        // [0, it]
        // cerr << i << endl;

        if ((z == 0 && c == '<') || (z == 1 && c == '>')) {
            if (it >= 0) {
                // cerr << "flip " << 0 << ' ' << it << endl;
                bs.flip(0, it);
            }
        }

        int it2 = upper_bound(all(a), y) - a.begin();

        it2--;
        it++;

        // [it, it2]
        if (it <= it2) {
            if ((z == 0 && c == '<') || (z == 1 && c == '>')) {
                // cerr << "set " << it << ' ' << it2 << ' ' << z << endl;
                bs.upd(it, it2, z);
            }
        }

        if (c == '<') {
            if (it2 + 1 < e.size()) {
                // cerr << "set " << it2 + 1 << ' ' << e.size() - 1 << ' ' << 0 << endl;
                bs.upd(it2 + 1, (int)e.size() - 1, 0);
            }
        } else {
            if (it2 + 1 < e.size()) {
                // cerr << "set " << it2 + 1 << ' ' << e.size() - 1 << ' ' << 1 << endl;
                bs.upd(it2 + 1, (int)e.size() - 1, 1);
            }
        }
    }

    for (int i = 0; i < e.size(); i++) {
        int x, t, j;
        tie(x, t, j) = e[i];

        ans[j] = bs.get(i);
        // cout << ans[j] << ' ';
        if (ans[j] == 0)
            ans[j] = x;
        else
            ans[j] = -x;
    }
    // cout << endl;

    for (int i = 0; i < n; i++)
        cout << ans[i] << ' ';
}