#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define per(i,a,b) for(int (i)=(b);(i)>=(a);--i)
typedef long long ll;
template<typename T>
void read(T&x){
    x=0;
    ll f=1;
    char ch=getchar();
    while(!isdigit(ch)){
        if(ch=='-')f*=-1;
        ch=getchar();
    }
    while(isdigit(ch)){
        x=x*10+ch-'0';
        ch=getchar();
    }
    x*=f;
}
//=====================================================
const int maxn=205;
int n,m;
struct Edge{
    int to,next,id;
}e[maxn*maxn*2];
int head[maxn],cnt;
int mark[maxn][maxn];
int c[maxn];
int ans[maxn*maxn*2];
struct Da{
    int u,v,num;
};
vector<Da>save;
void add(int x,int y,int z){
    e[cnt].to=y;
    e[cnt].next=head[x];
    e[cnt].id=z;
    e[cnt].next=head[x];
    head[x]=cnt++;
}
bool vis[maxn];

void dfs(int u){
    vis[u]=1;
    for(int i=head[u];~i;i=e[i].next){
        int v=e[i].to;
        if(ans[e[i].id]==0){
            ans[e[i].id]=(mark[u][v]?1:-1);
            if(!vis[v])dfs(v);
        }
    }
}

int main(){
    //freopen("in.txt","r",stdin);
    memset(head,-1,sizeof(head));
    read(n),read(m);
    rep(i,1,m){
        int x,y;
        read(x),read(y);
        save.push_back({x,y,i});
        mark[x][y]=1;
    }
    rep(i,1,n)read(c[i]);
    for(int i=0;i<save.size();i++){
        auto x=save[i];
        int u=x.u;
        int v=x.v;
        if(vis[u]&&vis[v])continue;
        if(c[u]>c[v])ans[x.num]=1;
        else if(c[u]<c[v])ans[x.num]=-1;
        else{
            add(u,v,i+1);
            add(v,u,i+1);
        }
    }
    rep(i,1,n){
        if(!vis[i]){
            dfs(i);
        }
    }
    rep(i,1,m){
        if(ans[i]==1)puts("->");
        else if(ans[i]==-1)puts("<-");
        else exit(-1);
    }
    return 0;
}
// khodaya khodet komak kon
# include <bits/stdc++.h>
 
/*
// ordered_set 
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
# define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
 
using namespace std;
 
typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
typedef pair <pii, int>                                  ppi;
typedef pair <int, pii>                                  pip;
typedef pair <pii, pii>                                  ppp;
typedef pair <ll, ll>                                    pll;
 
# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define SZ(x)                                           int(x.size())
# define lc                                              id << 1
# define rc                                              id << 1 | 1
# define InTheNameOfGod                                  ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
 
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}
 
const int xn = 1e2 + 10;
const int xm = - 20 + 10;
const int sq = 320;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int mod = 1e9 + 7;//998244353;
const int base = 257;

int n, m, a[xn * xn], c[xn], H[xn], res;
pii E[xn * xn];
bool mark[xn];
vector <pii> adj[xn];
vector <int> G[xn];

void DFS2(int v){
	mark[v] = true, ++ res;
	for (int u : G[v])
		if (!mark[u])
			DFS2(u);
}
void DFS(int v, int ind = - 1){
	mark[v] = true;
	for (pii u : adj[v]){
		if (u.B == ind)
			continue;
		if (mark[u.A]){
			if (H[u.A] < H[v])
				a[u.B] = u.A;
			continue;
		}
		a[u.B] = u.A;
		H[u.A] = H[v] + 1;
		DFS(u.A, u.B);
	}
}

int main(){
	InTheNameOfGod;
	
	cin >> n >> m;
	for (int i = 0; i < m; ++ i){
		int v, u;
		cin >> v >> u;
		E[i] = {v, u};
	}
	for (int i = 1; i <= n; ++ i)
		cin >> c[i];
	for (int i = 0; i < m; ++ i){
		int v = E[i].A, u = E[i].B;
		if (c[v] != c[u])
			continue;
		adj[v].push_back({u, i});
		adj[u].push_back({v, i});
	}
	for (int i = 1; i <= n; ++ i)
		if (!mark[i])
			DFS(i);
	for (int i = 0; i < m; ++ i){
		int v = E[i].A, u = E[i].B;
		if (c[v] > c[u]){
			a[i] = u;
			G[v].push_back(u);
		}
		else if (c[v] < c[u]){
			a[i] = v;
			G[u].push_back(v);
		}
		else{
			if (a[i] == v)
				G[u].push_back(v);
			else
				G[v].push_back(u);
		}
	}
	for (int i = 1; i <= n; ++ i){
		memset(mark, false, sizeof mark);
		res = 0, DFS2(i);
		if (res != c[i])
			kill(- 1);
	}
	for (int i = 0; i < m; ++ i){
		int v = E[i].A, u = E[i].B;
		if (a[i] == u)
			cout << "->" << endl;
		else
			cout << "<-" << endl;
	}
	
	return 0;
}
