#include <stdio.h>
#include <algorithm>
#include <set>
#include <tuple>
#include <queue>
#include <vector>
using namespace std;
using ll = unsigned long long;
using pii = pair<int, int>;

int n, m, a[10000], b[10000], c[200], d[10000], v[200];
vector<pii> e[200];
void dfs(int x, int p) {
	if (v[x])
		return;
	v[x] = 1;

	for (pii ed : e[x]) {
		int y, id;
		tie(y, id) = ed;
		if (y == p)
			continue;
		if (d[id])
			continue;

		d[id] = (a[id] == x ? 2 : 3);
		dfs(y, x);
	}
}
int main() {
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; i++)
		scanf("%d %d", a + i, b + i);
	for (int i = 1; i <= n; i++)
		scanf("%d", c + i);

	for (int i = 0; i < m; i++) {
		if (c[a[i]] != c[b[i]])
			d[i] = ((c[a[i]] > c[b[i]]) ? 2 : 3);
		else {
			e[a[i]].emplace_back(b[i], i);
			e[b[i]].emplace_back(a[i], i);
		}
	}
	for (int i = 1; i <= n; i++)
		dfs(i, 0);

	for (int i = 0; i < m; i++)
		printf((d[i] ^ 2) ? "<-\n" : "->\n");
}
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+9;
const LL INF = 1LL<<60;
const double eps = 1e-4;
const double PI=3.1415926535897932;

map<pair<int,int>, int> e;
int ans[100009];
void f(int a,int b) {// a->b
    if(e.count({b,a}))ans[e[{b,a}]]=1;
}

vector<int> adj[100009];
bool vis[100009];
int c[100009];
int h[100009];

void dfs(int x, int p){
    //printf("D %d %d\n",x,p);
    for(int i:adj[x]){
        //printf("N %d\n",i);
        if(i==p||c[i]!=c[x])continue;
        if(!vis[i] || h[i]<h[x])f(x,i);
        if(!vis[i]){
            h[i]=h[x]+1;
            vis[i]=1;
            dfs(i,x);
        }
    }
}

int main(){
    DRII(n,m);
    REP(i,m){
        DRII(a,b);a--;b--;
        e[MP(a,b)]=i;
        adj[a].PB(b);
        adj[b].PB(a);
    }
    REP(i,n)RI(c[i]);
    for(auto v:e){
        if(c[v.F.F]==c[v.F.S])continue;
        if(c[v.F.F]>c[v.F.S])f(v.F.F,v.F.S);
        else f(v.F.S,v.F.F);
    }
    REP(i,n){
        if(vis[i])continue;
        vis[i]=1;
        dfs(i,-1);
    }
    REP(i,m){
        if(ans[i])puts("<-");
        else puts("->");
    }
}
