#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)
#define popcount __builtin_popcount

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(ll x=pow(10,7)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { ll d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll modpow(ll x, ll p) { ll result = 1, now = 1, pm = x; while (now<=p) { if (p&now) { result = result * pm % MOD; } now*=2; pm = pm*pm % MOD; } return result; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

struct edge  { ll i, a, b, rev; };

vector<vector<edge>> adj;
vector<ll> toa;

void dfs(ll n, ll p=-1) {
  for (auto x: adj[n]) {
    if (toa[x.i]==-1) {
      toa[x.i] = x.rev;
      dfs(x.a,n);
    }
  }
}

int main() {
  ll N, M; cin >> N >> M;
  edge e[M];
  rep(i,M) { 
    e[i].rev = false;
    e[i].i = i; 
    cin >> e[i].a >> e[i].b; e[i].a--; e[i].b--;
  }
  ll c[N]; rep(i,N) cin >> c[i];

  adj.resize(N);
  toa.resize(M,-1);
  rep(i,M) {
    if      (c[e[i].a]>c[e[i].b]) toa[e[i].i] = false;
    else if (c[e[i].a]<c[e[i].b]) toa[e[i].i] = true;
    else {
      // toはaを使う
      adj[e[i].a].push_back({e[i].i,e[i].b,e[i].a,false});
      adj[e[i].b].push_back({e[i].i,e[i].a,e[i].b,true});
    }
  }

  rep(i,N) dfs(i);

  rep(i,M) {
    string result = toa[i] ? "<-" : "->";
    cout << result << endl;
  }
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
int n,m,X[100010],Y[100010],c[110];
vector<int> g[110];
int ans[110][110];
bool vis[110];
int st[110],tot,flag,inst[110];
vector<int> hi,cyc;
int sz,on[110],ban[110];
void dfs(int u,int p) {
	//printf("%d\n",u);
	vis[u]=1; st[++tot]=u; inst[u]=1;
	hi.push_back(u);
	for (int i=0,v;i<g[u].size();i++) {
		v=g[u][i];
		if (v==p) continue;
		if (!vis[v]) {
			dfs(v,u);
		} else if (inst[v]&&!flag) {
			flag=1;
			for (int j=tot;j>=1;j--) {
				cyc.push_back(st[j]);
				if (st[j]==v) break;
			}
		}
	}
	inst[u]=0,tot--;
}
int tim,ora[110],ts,fx;
void sc(int u) {
	if (ora[u]==tim) return; ora[u]=tim;
	st[++tot]=u,inst[u]=1;
	if (on[u]) {
		if (!fx) {
			for (int i=1;i<tot;i++) ans[st[i]][st[i+1]]=1,ans[st[i+1]][st[i]]=0;
		} else {
			for (int i=1;i<tot;i++) ans[st[i+1]][st[i]]=1,ans[st[i]][st[i+1]]=0;
		}
	//	for (int i=1;i<=tot;i++) printf("%d ",st[i]); printf("\n");
		for (int i=2;i<=tot;i++) ban[st[i]]=ts;
		flag=1; return;
	}
	for (int i=0,v;i<g[u].size();i++) {
		v=g[u][i];
		if (inst[v]) continue;
		if (ans[v][u]!=-1&&ans[v][u]!=fx) continue;
		sc(v); if (flag) return;
	}
	tot--,inst[u]=0;
}
int ttt[110],tttim;
bool fd(int u,bool f) {
	if (on[u]) return 1;
	if (ttt[u]==tttim) return 0;
	ttt[u]=tttim;
	for (int i=0,v;i<g[u].size();i++) {
		v=g[u][i];
		if (ans[u][v]==f) {
			if (fd(v,f)) return 1;
		}
	}
	return 0;
}
vector<int> G[110];
int t[110],cnt;
void ddfs(int u) {
	if (t[u]) return;
	t[u]=1,cnt++;
	for (int i=0,v;i<G[u].size();i++) {
		v=G[u][i];
		ddfs(v);
	}
}
int main() {
	read(n),read(m); int x,y;
	for (int i=1;i<=m;i++) {
		read(x),read(y);
		X[i]=x,Y[i]=y;
	}
	memset(ans,-1,sizeof(ans));
	for (int i=1;i<=n;i++) read(c[i]);
	for (int i=1;i<=m;i++) {
		x=X[i],y=Y[i];
		if (c[x]==c[y]) {
			g[x].push_back(y),g[y].push_back(x);
			//printf("add %d %d\n",x,y);
		} else {
			if (c[x]>c[y]) ans[x][y]=1,ans[y][x]=0; else ans[y][x]=1,ans[x][y]=0;
		}
	}
	for (int i=1;i<=n;i++) if (!vis[i]) {
		flag=0,cyc.clear(),hi.clear(),dfs(i,0);
		sz=(int)cyc.size();
		for (int j=0;j<sz;j++) ans[cyc[j]][cyc[(j+1)%sz]]=1,ans[cyc[(j+1)%sz]][cyc[j]]=0,on[cyc[j]]=1;
	//	for (int j=0;j<sz;j++) printf("%d ",cyc[j]); printf("\n");
		if ((int)hi.size()==1) continue;
		for (int j=0;j<hi.size();j++) {
			x=hi[j];
			ts++;
			if (on[x]) continue;
			tttim++;
			if (!fd(x,1)) {
				//printf("x1=%d\n",x);
				tim++,flag=0,fx=0,sc(x);
				assert(flag);
				while (tot) inst[st[tot]]=0,tot--;
			}
			tttim++;
			if (!fd(x,0)) {
				//printf("x2=%d\n",x);
				tim++,flag=0,fx=1,sc(x);
				assert(flag);
				while (tot) inst[st[tot]]=0,tot--;
			}
			on[x]=1;
		}
	}
	for (int i=1;i<=m;i++) {
		x=X[i],y=Y[i];
		if (ans[x][y]) puts("->");
		else puts("<-");
		
		//if (ans[x][y]) G[x].push_back(y);//,printf("%d %d\n",x,y);
		//else G[y].push_back(x);//,printf("%d %d\n",y,x);
	}
/*	for (int i=1;i<=n;i++) {
		for (int j=1;j<=n;j++) t[j]=0; cnt=0;
		ddfs(i);
		if (cnt!=c[i]) printf("%d %d %d\n",i,cnt,c[i]);
	}
	//puts("");
	puts("AC");*/
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/