#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <bitset>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>
#include <algorithm>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <ctime>
#include <chrono>


/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,tune=native")
*/


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << x << endl;
#else
    #define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a, b) for (int i = a; i < b; i++)
#define fj(a, b) for (int j = a; j < b; j++)
#define fk(a, b) for (int k = a; k < b; k++)
#define fi1(a, b) for (int i = a - 1; i >= b; i--)
#define fj1(a, b) for (int j = a - 1; j >= b; j--)
#define fk1(a, b) for (int k = a - 1; k >= b; k--)
#define fx(x, a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, const T2 &y) { if (y < x) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, const T2 &y) { if (x < y) x = y; }

ostream& operator << (ostream &out, const vector<int> &b) {
    for (auto k : b) out << k << ' ';
    return out;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

vi g[MX];
int turn[MX];
int c[MX];
vpii edges;
int used[MX];
int dp[MX];

void make(int id, int a, int b) {
	if (edges[id].first == a)
		turn[id] = 0;
	else
		turn[id] = 1;
}

void dfs(int v, int prid =-1) {
	used[v] = 1;
	fx(id, g[v]) {
		if (id == prid) continue;
		int to = edges[id].first ^ edges[id].second ^ v;
		if (c[to] != c[v]) continue;
		if (used[to]) {
			if (dp[to] < dp[v]) {
				make(id, v, to);
			}
		} else {
			dp[to] = dp[v] + 1;
			make(id, v, to);
			dfs(to, id);
		}
	}
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, m;
    cin >> n >> m;
    fi(0, m) {
    	int a, b;
    	cin >> a >> b;
    	--a, --b;
    	g[a].pb(i);
    	g[b].pb(i);
    	edges.pb({a, b});
    	turn[i] = -1;
    }

    vi p(n);
    fi(0, n) {
   		cin >> c[i];
    	p[i] = i;
    }
    sort(all(p), [&](int i, int j) {
    	return c[i] < c[j];
    });
    for (int col = 2; col <= n; ++col) {
    	fi(0, n) {
    		if (!used[i] && c[i] == col) {
    			dfs(i);
    		}
    	}
    }
    fx(v, p) {
    	fx(id, g[v]) {
    		if (turn[id] == -1) {
    			int to = edges[id].first ^ edges[id].second ^ v;
    			assert(c[to] > c[v]);
    			make(id, to, v); 
    		}
    	}
    }
    fi(0, m) {
    	assert(turn[i] != -1);
    	if (turn[i] == 0) {
    		cout << "->\n";
    	} else {
    		cout << "<-\n";
    	}
    } 
}

#include<bits/stdc++.h>
using namespace std;
#define ma 2147483647
#define ll long long
#define ld long double
#define pii pair<int,int>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define um unordered_map
#define vi vector<int>
#define mii map<int,int>
#define si set<int>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*(b/gcd(a,b))
#define mmst(a,b) memset(a,b,sizeof(a))
int n,m;
int a[10005],b[10004],c[10005],ans[10005];
int tu[200][200];
void dfs(int x)
{
	for (int i=1;i<=n;i++)
	{
		if (tu[x][i]!=0)
		{
			ans[ abs(tu[x][i]) ] = tu[x][i]/abs(tu[x][i]);
			tu[x][i]=0;
			tu[i][x]=0;
			dfs(i);
		}
	}
}
int main()
{ 
	//freopen("d.in","r",stdin);
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		a[i]=x,b[i]=y;
	}
	for (int i=1;i<=n;i++) scanf("%d",&c[i]);
	for (int i=1;i<=m;i++)
	{
		if (c[a[i]]<c[b[i]]) ans[i]=-1;
		if (c[a[i]]>c[b[i]]) ans[i]=1;
	}
	for (int i=1;i<=m;i++)
	{
		if ( c[a[i]] == c[b[i]] )
		{
			tu[a[i]][b[i]]=i;
			tu[b[i]][a[i]]=-i;
		}
	}
	for (int i=1;i<=n;i++)
	{
		dfs(i);
	}
	for (int i=1;i<=m;i++)
	{
		if (ans[i]<0) printf("<-");
		if (ans[i]>0) printf("->");
		printf("\n");
	}
}