#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define pii pair<int,int>
#define mp make_pair
#define pll pair<long long,long long>

using namespace std;

const int nax = 105;

vector<int> adj[nax];
set<pair<pii, int> > s;
set<pair<pii, int> > zostaly;
int n,m;
int c[nax];
int ans[nax * nax * nax];

bool vis[nax];
set<pii> zero;

int dep[nax];

void dfs(int v,int lvl)
{
    dep[v] = lvl;
    vis[v] = true;
    for(int x : adj[v])
    {
        if(vis[x] == false && c[x] == c[v])
        {
            zero.insert(mp(v,x));
            dfs(x,lvl+1);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        int x,y; cin>>x>>y;
        s.insert(mp(mp(x,y),i));
    }

    for(int i=1;i<=n;i++) cin>>c[i];
    for(auto x : s)
    {
        int fr = x.st.st;
        int to = x.st.nd;
        int nbr = x.nd;

        if(c[fr] != c[to])
        {
            if(c[fr] > c[to]) ans[nbr] = 0;
            else ans[nbr] = 1;
        }
        else
        {
            zostaly.insert(x);
            adj[fr].pb(to);
            adj[to].pb(fr);
        }
    }

    for(int i=1;i<=n;i++)
    {
        if(vis[i] == false) dfs(i,0);
    }


    for(auto x : zostaly)
    {
        pii cur = x.st;
        pii xd = mp(cur.nd,cur.st);
        if(zero.count(cur) || zero.count(xd))
        {
            // w dol

            if(dep[cur.st] < dep[cur.nd]) ans[x.nd] = 0;
            else ans[x.nd] = 1;
        }
        else
        {
            int one = x.st.st;
            int two = x.st.nd;
            if(dep[one] > dep[two]) ans[x.nd] = 0;
            else ans[x.nd] = 1;
        }
    }

    for(int i=1;i<=m;i++)
    {
        if(ans[i] == 0) cout<<"->"<<"\n";
        else cout<<"<-"<<"\n";
    }


    return 0;
}

#include "bits/stdc++.h"
//#include "atcoder/all"
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n-1); i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define endl "\n"

vector<int>to[100];
bool Check[100];
map<pair<int, int>, int>mp;
vector<string>Ans(10000);
vector<int>A(10000);
vector<int>B(10000);

void dfs(int v, int p = -1) {
	if (Check[v]) {
		return;
	}
	Check[v] = true;
	for (int e : to[v]) {
		if (p == e) {
			continue;
		}
		if (mp.count({ v,e })) {
			if (v == A[mp[{v, e}]]) {
				Ans[mp[{v, e}]] = "->";
			}
			else {
				Ans[mp[{v, e}]] = "<-";
			}
			mp.erase({ v,e });
			mp.erase({ e,v });
		}
		dfs(e, v);
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	rep (i,M) {
		cin >> A[i] >> B[i];
		A[i]--;
		B[i]--;
	}
	vector<int>C(N);
	rep (i,N) {
		cin >> C[i];
	}
	rep(i, M) {
		if (C[A[i]] == C[B[i]]) {
			to[A[i]].push_back(B[i]);
			to[B[i]].push_back(A[i]);
			mp[{ A[i], B[i] }] = i;
			mp[{ B[i], A[i] }] = i;
			continue;
		}
		if (C[A[i]] > C[B[i]]) {
			Ans[i] = "->";
		}
		else {
			Ans[i] = "<-";
		}
	}
	rep(i, N) {
		if (Check[i]) {
			continue;
		}
		dfs(i);
	}
	rep(i, M) {
		cout << Ans[i] << endl;
	}
	return 0;
}