#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<ctime>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<bitset>
#include<functional>
#include <fstream>
//#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 10000000000000000;
const int intINF = 1000000000;
const ll mod = 1000000007;
const ll MOD = 998244353;
const ld pi = 3.141592653589793238;

bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p % i == 0) return false;
	}
	return true;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}
ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}
//printf("%.10f\n", n);
typedef pair <ll, ll> P;
ll dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
struct edge { ll to, cost; };
struct status {
	ll cost;
	ll bango;

	bool operator<(const status& rhs) const { return cost < rhs.cost; };
	bool operator>(const status& rhs) const { return cost > rhs.cost; };
};

ll n, m;
vector<string> ansG(5000); vector<ll> c(101);
vector<vector<P>> G1(101), G2(101);
vector<bool> henvisit(5000, false);
vector<bool> visit(101, false);
void dfs(ll x) {
	//cout << x << endl;
	ll ko = c[x], to = 0;
	for (int i = 0; i < G1[x].size(); i++) {
		ll next = G1[x][i].first, ban = G1[x][i].second;
		if (c[next] == ko && !visit[next] && !henvisit[ban]) {
			visit[next] = true; henvisit[ban] = true; ansG[ban] = "->";
			dfs(next);
			//cout << G1[q][i].second << endl;
		}
		if (c[next] == ko && visit[next] && !henvisit[ban]) {
			henvisit[ban] = true; ansG[ban] = "->";
		}
	}
	for (int i = 0; i < G2[x].size(); i++) {
		ll next = G2[x][i].first, ban = G2[x][i].second;
		if (c[next] == ko && !visit[next] && !henvisit[ban]) {
			//cout << G2[q][i].second << endl;
			visit[next] = true; henvisit[ban] = true; ansG[ban] = "<-";
			dfs(next);
		}
		if (c[next] == ko && visit[next] && !henvisit[ban]) {
			henvisit[ban] = true; ansG[ban] = "<-";
		}
	}
}

signed main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	//cout << fixed << setprecision(15);

	//input
	cin >> n >> m;
	vector<ll> a(m), b(m);
	rep(i, m) {
		cin >> a[i] >> b[i];
		G1[a[i]].push_back(P(b[i], i)); G2[b[i]].push_back(P(a[i], i));
	}
	rep2(i, n) { cin >> c[i]; }
	//dfs
	rep(i, m) {
		if (henvisit[i]) { continue; }
		if (c[a[i]] > c[b[i]]) { ansG[i] = "->"; henvisit[i] = true; }
		else if (c[a[i]] < c[b[i]]) { ansG[i] = "<-"; henvisit[i] = true; }
		else if (visit[a[i]] && visit[b[i]]) { ansG[i] = "->"; }
		else {
			dfs(a[i]);
		}
	}
	//output
	rep(i, m) {
		cout << ansG[i] << endl;
	}
	return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=110;
const int inf=2147483647;
const double pi=acos(-1.0);
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int n,m,c[Maxn],ans[Maxn*Maxn],fa[Maxn],dep[Maxn],ex[Maxn*Maxn],ey[Maxn*Maxn],px,py,o,d[Maxn];
vector<pa>G[Maxn];
void dfs(int x,int f,int u)
{
	dep[x]=dep[f]+1;fa[x]=f;d[x]=u;
	for(int i=0;i<G[x].size();i++)
	{
		int t=G[x][i].second;
		if(t==u)continue;
		int y=G[x][i].first;
		if(!dep[y])ans[t]=(x==ey[t]),dfs(y,x,t);
		else
		{
			if(dep[y]<dep[x])ans[t]=(x==ey[t]);
			else ans[t]=(y==ey[t]);
		}
	}
} 
int main()
{
	n=read(),m=read();
	for(int i=1;i<=m;i++)ex[i]=read(),ey[i]=read();
	for(int i=1;i<=n;i++)c[i]=read();
	for(int i=1;i<=m;i++)
	{
		int x=ex[i],y=ey[i];
		if(c[x]==c[y])G[x].push_back(make_pair(y,i)),G[y].push_back(make_pair(x,i));
		else
		{
			if(c[x]>c[y])ans[i]=0;
			else ans[i]=1;
		}
	}
	dep[0]=0;
	for(int i=1;i<=n;i++)
	if(!dep[i])
	{	
		py=-1;
		dfs(i,0,0);
	}
	for(int i=1;i<=m;i++)
	{
		if(!ans[i])puts("->");
		else puts("<-");
	}
}