#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //int:2*10**9
typedef long double ld;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define vec2(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
#define vec3(name,i,j,k,l) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k,l)))
#define pb push_back
#define MOD 1000000007 //998244353
#define PI 3.141592653
#define INF 100000000000000 //14
#define N 110
#define M 5000
//cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
vector<vector<ll>> conn(N);
vector<vector<ll>> path(M,vector<ll>(2));
vector<ll> fin(M,0);
vector<ll> c(N);

void bfs(ll x) {
    REP(i,conn[x].size()){
        ll next = conn[x][i];
        if (fin[next]!=0) continue;
        if (path[next][0]==x) {
            fin[next]=1;
            bfs(path[next][1]);
        }
        else {
            fin[next]=2;
            bfs(path[next][0]);
        }
    }
    return;
}

int main(){
    ll n, m; cin >> n >> m;
    REP(i,m) {
        ll a, b; cin >> a >> b;a--;b--;
        path[i][0]=a;path[i][1]=b;
        conn[a].pb(i);
        conn[b].pb(i);
    }
    REP(i,n) cin >> c[i];
    REP(i,m) {
        // cout << i << " " << path[i][0] << " " << path[i][1] << " " << c[path[i][0]] << " " << c[path[i][1]] << endl;
        if (c[path[i][0]]>c[path[i][1]]) fin[i]=1;
        else if (c[path[i][0]]<c[path[i][1]]) fin[i]=2;
    }
    // REP(i,m) cout << fin[i] << " ";
    // cout << endl;
    ll now = 0;
    while (now<m) {
        if (fin[now]!=0) {
            now++;
            continue;
        }
        fin[now]=1;
        bfs(path[now][1]);
        // cout << "test1" << " " << now << endl;
        // REP(i,m) cout << fin[i] << " ";
        // cout << endl;
    }
    REP(i,m) {
        if (fin[i]==1) cout << "->" << endl;
        else cout << "<-" << endl;
    }
}
#include <bits/stdc++.h>
#define ll long long
const int INF = 1000000000;
using namespace std;
const int MAX = 105;

int edgeDir[MAX * MAX], c[MAX], used[MAX];

vector<pair<int, pair<int, int> > > g[MAX];

void dfs(int u) {
	used[u] = 1;
	for(auto e : g[u]) {
		int v = e.first;
		int eId = e.second.first;
		int reverted = e.second.second;
		if(c[v] > c[u]) {
			edgeDir[eId] = reverted ^ 1;
		} else if(c[v] == c[u]) {
			edgeDir[eId] = reverted;
			if(!used[v]) {
				dfs(v);
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	int N, M;
	cin >> N >> M;
	for(int i = 0; i < M; i++) {
		int u, v;
		cin >> u >> v;
		--u;--v;
		g[u].push_back({v, {i, 0}});
		g[v].push_back({u, {i, 1}});
	}
	vector<int> verts;
	for(int i = 0; i < N; i++) {
		cin >> c[i];
		verts.push_back(i);
	}
	sort(verts.begin(), verts.end(), [&](int u, int v) {
		return c[u] < c[v];
	});
	for(auto u : verts) {
		//cerr << u << '\n';.
		if(!used[u]) {
			dfs(u);
		}
	}
	for(int i = 0; i < M; i++) {
		if(edgeDir[i]) {
			cout << "<-\n";
		} else {
			cout << "->\n";
		}
	}
}
