#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N,M;
  cin>>N>>M;
  vector<int> A(M),B(M);
  rep(i,M) cin>>A[i]>>B[i];
  vector<int> C(N);
  rep(i,N) cin>>C[i];

  rep(i,M){
    A[i]--;B[i]--;
  }

  vector<set<int>> gs(N);
  rep(i,M){
    if(C[A[i]]!=C[B[i]]) continue;
    gs[A[i]].insert(B[i]);
    gs[B[i]].insert(A[i]);
  }

  map<pair<int,int>,int> mp;
  rep(i,M) mp[mkp(A[i],B[i])]=i;

  vector<int> ans(M,-1);
  rep(i,M){
    if(C[A[i]]<C[B[i]]) ans[i]=0;
    if(C[A[i]]>C[B[i]]) ans[i]=1;
  }

  auto dfs = [&](auto &&dfs,int now) -> void{
    while(!gs[now].empty()){
      int nex=*(gs[now].begin());
      gs[now].erase(nex);
      gs[nex].erase(now);

      if(mp.count(mkp(now,nex))) ans[mp[mkp(now,nex)]]=1;
      else ans[mp[mkp(nex,now)]]=0;

      dfs(dfs,nex);
    }
  };

  rep(i,N) dfs(dfs,i);

  rep(i,M){
    if(ans[i]==1) cout<<"->"<<"\n";
    else cout<<"<-"<<"\n";
  }

  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M = 102;
int U[M*M],V[M*M];
vector<int> vtr[M];
bool f[M*M],vis[M];
int arr[M],c[M],t=0;
int adj(int u,int e)
{
	if(U[e]==u)
		return V[e];
	return U[e];
}
int dfs(int x,int edge, int p)
{
	vis[x]=1;
	arr[x] = arr[p] + 1;
	int mn=arr[x];
	for(auto e: vtr[x])
	{
		if(e == edge)
			continue;
		int u = adj(x, e);
		if(arr[u] > arr[x])
			continue;

		if(vis[u])
			mn = min(mn, arr[u]);
		else
			mn = min(mn, dfs(u, e, x));
		// x->u
		if(U[e] == x)
			f[e] = 0;
		else
			f[e] = 1;
	}
	return mn;
}
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
		cin>>U[i]>>V[i];
	for(int i=1;i<=n;i++)
		cin>>c[i];
	for(int i=1;i<=m;i++)
	{
		int u = U[i], v = V[i];
		if(c[u] > c[v])
			f[i] = 0;
		if(c[u] < c[v])
			f[i] = 1;
		if(c[u] == c[v])
		{
			vtr[u].pb(i);
			vtr[v].pb(i);
		}
	}
	for(int i=1;i<=n;i++)
		if(vis[i] == 0)
			dfs(i, -1, 0);
	for(int i=1;i<=m;i++)
	{
		if(f[i] == 0)
			cout<<"->\n";
		else
			cout<<"<-\n";
	}
	return 0;
}