#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
// using namespace atcoder;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("->");}else{puts("<-");}
#define MAX_N 205

struct edge{
    int to, id, dir;
};

vector<edge> G[MAX_N];
int ans[100000];
int c[1000];

void dfs(int x){
    rep(i,G[x].size()){
        edge e = G[x][i];
        int y = e.to;
        int id = e.id;
        int dir = e.dir;
        if(ans[id] != 0) continue;
        if(c[y] < c[x]){
            ans[id] = dir;
            continue;
        }
        ans[id] = dir;
        dfs(y);
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a, b;
    rep(i,m){
        int aa, bb;
        cin >> aa >> bb;
        aa--; bb--;
        edge e;
        e.to = bb;
        e.id = i;
        e.dir = 1;
        G[aa].push_back(e);
        e.to = aa;
        e.dir = 2;
        G[bb].push_back(e);
        a.push_back(aa);
        b.push_back(bb);
    }
   
    rep(i,n) cin >> c[i];

    if(m == 0){
        return 0;
    }
    
    vector<P> v;
    rep(i,n){
        v.push_back(P(c[i],i));
    }
    sort(v.begin(), v.end(), greater<P>());

    

    rep(i,v.size()){
        int x = v[i].second;
        dfs(x);
    }

    rep(i,m){
        if(ans[i] == 1) yn;
    }
    return 0;
}



#include <bits/stdc++.h>
using namespace std;
void fast() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
}
void ran() {
	srand(chrono::steady_clock::now().time_since_epoch().count());
}
long long get_rand() {
	long long a = rand();
	long long b = rand();
	return a * (RAND_MAX + 1ll) + b;
}
void usaco() {
	freopen("problem.in", "r", stdin); 
	freopen("problem.out", "w", stdout);
}
template<typename T>
using min_pq = priority_queue<T, vector<T>, greater<T>>;
// #define endl '\n'
// #define double long double
// #define int long long
// const int MOD = 1000 * 1000 * 1000 + 7;
// const int MOD = 998244353;

int n, m;
const int MXN = 105, MXM = 10005;
vector<pair<int, int>> ed;
int reach[MXN];
int dir[MXM];
vector<pair<int, int>> adj[MXN], nadj[MXN];

vector<int> act;
int state[MXN];

map<pair<int, int>, int> enm;

bool stop = false;

void dfs(int node, int par) {
	if (stop) return;
	if (state[node] == 1) {
		// on stack
		bool consid = false;
		vector<int> actr;
		for (int i=0; i<act.size(); i++) {
			if (act[i] == node) {
				consid = !consid;
			}
			if (consid) {
				actr.push_back(act[i]);
			}
		}
		// cout << "cyc" << endl;
		for (int i=0; i<actr.size(); i++) {
			// cout << actr[i] << ' ';
			int a = actr[i], b = actr[(i+1)%actr.size()];
			int x = enm[{a, b}];
			if (ed[x].first == a) {
				dir[x] = 1;
			}
			else {
				dir[x] = -1;
			}
		}
		stop = true;
		// cout << endl;
		return;
	}
	state[node] = 1;
	act.push_back(node);
	for (auto x: adj[node]) {
		if (stop) return;
		int ot = x.first;
		if (ot == par) continue;
		if (dir[x.second] != 0) continue;
		dfs(ot, node);
	}
	state[node] = 0;
	act.pop_back();
}

void cycle(int x) {
	while (true) {
		for (int i=0; i<MXN; i++) state[i] = 0;
		act.clear();
		stop = false;
		dfs(x, -1);
		if (!stop) return;
	}
}

void dfsn(int node, int par) {
	for (auto x: nadj[node]) {
		int ot = x.first;
		if (ot == par) continue;
		int num = x.second;
		if (ed[num].first == node) {
			dir[num] = 1;
		}
		else {
			dir[num] = -1;
		}
		dfsn(ot, node);
	}
}

signed main() {

	ran(); fast();

	cin >> n >> m;
	for (int i=0; i<m; i++) {
		int a, b;
		cin >> a >> b;
		ed.push_back({a, b});
		enm[ed.back()] = i;
		enm[{b, a}] = i;
	}
	for (int i=1; i<=n; i++) {
		cin >> reach[i];
	}
	
	for (int i=0; i<m; i++) {
		int a = ed[i].first, b = ed[i].second;
		if (reach[a] == reach[b]) {
			adj[a].push_back({b, i});
			adj[b].push_back({a, i});
		}
		else {
			if (reach[a] > reach[b]) dir[i] = 1;
			else dir[i] = -1;
		}
	}
	
	for (int i=1; i<=n; i++) {
		if (adj[i].size()) {
			cycle(i);
		}
	}
	
	for (int i=1; i<=n; i++) {
		for (auto x: adj[i]) {
			if (dir[x.second] == 0) {
				nadj[i].push_back(x);
				// cout << i << ' ' << x.first << ' ' << x.second << endl;
			}
		}
	}
	
	for (int i=1; i<=n; i++) {
		if (nadj[i].size() == 1) {
			dfsn(i, -1);
		}
	}
	
	for (int i=0; i<m; i++) {
		if (dir[i] == 1) cout << "->" << endl;
		else if (dir[i] == -1) cout << "<-" << endl;
		else assert(false);
	}

}
