/**
 *  created: 09/01/2021, 14:56:06
**/

#include <bits/stdc++.h>

using namespace std;

const int max_n = 111, inf = 1000111222;
const int max_m = max_n * max_n;

int n, m, a[max_n], from[max_m], to[max_m], ans[max_m];
vector<pair<int, int>> g[max_n];
int h[max_n];

void dfs(int v) {
    for (auto p : g[v]) {
        int id = p.first, tp = p.second;
        const int nxt = v ^ from[id] ^ to[id];
        if (h[nxt] == -1) {
            ans[id] = 0 ^ tp;
            h[nxt] = h[v] + 1;
            dfs(nxt);
        } else if (h[nxt] + 1 < h[v]) {
            ans[id] = tp;
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        cin >> from[i] >> to[i];
        --from[i];
        --to[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < m; ++i) {
        if (a[from[i]] != a[to[i]]) {
            ans[i] = a[from[i]] < a[to[i]];
        } else {
            g[from[i]].push_back({i, 0});
            g[to[i]].push_back({i, 1});
        }
    }
    memset(h, -1, sizeof(h));
    for (int i = 0; i < n; ++i) {
        if (h[i] == -1) {
            h[i] = 0;
            dfs(i);
        }
    }
    for (int i = 0; i < m; ++i) {
        if (ans[i] == 0) {
            cout << "->\n";
        } else {
            cout << "<-\n";
        }
    }
    return 0;
}

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC loop-opt(on)

#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define print(x) cout << #x <<" = " << x <<"\n"
#define pprint(x) cout << #x <<" = (" << x.first <<", " << x.second <<")\n"
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))

#define INF 1000000000000000000
#define MAXN 200 
#define MOD 1000000007
#define eps (1e-9)

#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())

using namespace std;
int n, m, c[MAXN * MAXN], d[MAXN * MAXN];
int ans[MAXN*MAXN], v[MAXN*MAXN];
pii p[MAXN*MAXN];
int mp[MAXN][MAXN], timestamp, a, b;
void dfs(int x) {
	d[x] = ++timestamp;
	rep(i, 1, n) {
		if(c[i] == c[x] && !d[i] && mp[i][x]) {
			mp[x][i] = -1, mp[i][x] = -2;
			dfs(i);
		}
	}
	return;
}
void solve() {
	timestamp = 0;
	rep(i, 1, n) {
		if(!d[i]) d[i] = 1, dfs(i);
	}
	rep(i, 1, m) {
		tie(a, b) = p[i];
		if(c[a] > c[b]) ans[i] = -1;
		else if(c[b] > c[a]) ans[i] = -2;
		else if(mp[a][b] < 0) ans[i] = mp[a][b];
		else ans[i] = (d[a] > d[b] ? -1 : -2); 
		mp[a][b] = ans[i];
		mp[b][a] = -3 - ans[i];
	} 
	return ;
}
int dfs1(int x) {
	int cnt = 1; v[x] = 1;
	rep(i, 1, n) {
		if(!v[i] && mp[x][i] == -1) cnt += dfs1(i);
	}
	return cnt;
}
bool check() {
	rep(i, 1, n) {
		memset(v, 0, sizeof(v));
		if(dfs1(i) != c[i]) return false;
	}
	return true;
}
signed main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m;
	rep(i, 1, m) {
		cin >> a >> b;
		p[i] = {a, b};
		mp[a][b] = mp[b][a] = 1;
	}
	rep(i, 1, n) cin >> c[i];
	solve();
	assert(check());
	rep(i, 1, m) {
		if(ans[i] == -1) cout <<"->\n";
		else cout <<"<-\n"; 
	}
	return 0;
}