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

typedef long long ll;
typedef unsigned long long ull;

#define mp make_pair
#define fr first
#define sc second

struct Graph{
	int n;
	vector<vector<pair<int,int>>> G;
	Graph(int n_){ init(n_); }
	Graph(){}
	virtual void init(int n_){
		n=n_;
		G=vector<vector<pair<int,int>>>(n,vector<pair<int,int>>());
	}
	virtual void add_edge(int u,int v,int i=0){
		G[u].push_back(mp(v,i));
	}
};

Graph g;
vector<int> num,used;
int dfs(int v,int i,int p,int k){
	if(num[v]!=-1)return k;
	num[v]=k++;
	if(i!=-1)used[i]=1;
	for(auto ed: g.G[v]){
		k=dfs(ed.fr,ed.sc,v,k);
	}
	return k;
}
void dfs_tree(int n,int m){
	num.resize(n,-1);
	used.resize(m,0);
	int k=0;
	for(int i=0;i<n;i++){
		if(num[i]==-1)k=dfs(i,-1,-1,k);
	}
}

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	vector<int> a(m),b(m);
	for(int i=0;i<m;i++){
		scanf("%d%d",&a[i],&b[i]); a[i]--; b[i]--;
	}
	vector<int> c(n);
	for(int i=0;i<n;i++)scanf("%d",&c[i]);
	
	g.init(n);
	for(int i=0;i<m;i++){
		if(c[a[i]]==c[b[i]]){
			g.add_edge(a[i],b[i],i);
			g.add_edge(b[i],a[i],i);
			//cerr<<a[i]<<" "<<b[i]<<endl;
		}
	}
	dfs_tree(n,m);
	
	//for(int i=0;i<n;i++)cerr<<num[i]<<" "; cerr<<endl;
	//for(int i=0;i<m;i++)cerr<<used[i]<<" "; cerr<<endl;
	
	for(int i=0;i<m;i++){
		if(c[a[i]]!=c[b[i]]){
			if(c[a[i]]>c[b[i]])puts("->");
			else puts("<-");
		}
		else {
			int t=used[i];
			if(num[a[i]]<num[b[i]])t++;
			if(t==1)puts("<-");
			else puts("->");
		}
	}
}
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;

#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
//#define inf 1010000000
#define inf 4000000000000000000
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define ykh mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#ifdef i_am_noob
#define bug(...) cerr << "#" << __LINE__ << ' ' << #__VA_ARGS__ << "- ", _do(__VA_ARGS__)
template<typename T> void _do(T && x) {cerr << x << endl;}
template<typename T, typename ...S> void _do(T && x, S&&...y) {cerr << x << ", "; _do(y...);}
#else
#define bug(...) 826
#endif
template<typename T> void print(T && x) {cout << x << "\n";}
template<typename T, typename... S> void print(T && x, S&&... y) {cout << x << ' ';print(y...);}

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;
const int maxn=100005;
//i_am_noob
int n,m,e[maxn][3],a[105];
vector<pii> adj[105];
bool vis[105];

void dfs(int u, int par){
    vis[u]=true;
    for(auto p: adj[u]){
        int v=p.first;
        if(vis[v]){
            if(e[p.second>=0?p.second:-p.second-1][2]==2){
                if(p.second>=0) e[p.second][2]=1;
                else e[-p.second-1][2]=0;
            }
            continue;
        }
        if(e[p.second>=0?p.second:-p.second-1][2]==2){
            if(p.second>=0) e[p.second][2]=1;
            else e[-p.second-1][2]=0;
        }
        dfs(v,u);
    }
}

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    #ifdef i_am_noob
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
    cin >> n >> m;
    rep(m){
        cin >> e[i][0] >> e[i][1];
        e[i][0]--,e[i][1]--;
    }
    rep(n) cin >> a[i];
    rep(m){
        if(a[e[i][0]]>a[e[i][1]]) e[i][2]=1;
        else if(a[e[i][0]]<a[e[i][1]]) e[i][2]=0;
        else adj[e[i][0]].pb({e[i][1],i}),adj[e[i][1]].pb({e[i][0],-i-1}),e[i][2]=2;
    }
    rep(n) if(!vis[i]) dfs(i,-1);
    rep(m){
        if(e[i][2]==2)  print("a");
        print(e[i][2]?"->":"<-");
    }
    return 0;
}