#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << '\n'; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin, n, m;
    vector<int> a(m), b(m);
    rep(i, 0, m) {
        cin, a[i], b[i];
        a[i]--;
        b[i]--;
    }
    vector<int> c(n);
    rep(i, 0, n) {
        cin, c[i];
    }
    vector<P> ans(m, P{-1, -1});
    vector<vector<P>> g(n);
    rep(i, 0, m) {
        int ai = a[i], bi = b[i];
        if (c[ai] < c[bi]) {
            ans[i] = {bi, ai};
        } else if (c[ai] > c[bi]) {
            ans[i] = {ai, bi};
        } else {
            g[ai].emplace_back(bi, i);
            g[bi].emplace_back(ai, i);
        }
    }

    vector<bool> used(n, false);
    auto rec = [&](auto &f, int v, int p) -> void {
        if (used[v]) return;
        used[v] = true;
        for (auto [nxt, idx] : g[v]) {
            if (nxt == p) continue;
            if (ans[idx].first == -1) {
                dump(idx, v, nxt);
                ans[idx] = {v, nxt};
            }
            f(f, nxt, v);
        }
    };
    rep(i, 0, n) {
        if (!used[i]) {
            rec(rec, i, -1);
        }
    }

    rep(i, 0, m) {
        int ai = a[i];
        auto [x, y] = ans[i];
        if (ai == x) {
            print("->");
        } else {
            print("<-");
        }
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define lui long unsigned int

const int N =3e5+5;
const int MOD = 1e9+7;
const ll M = 1e18;

ll qpow(ll a, ll b, ll m)
{
    ll  ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int n,m;
int c[101];
vector<vector<int>>adj;
map<pii,int>edge;
vector<int>ans;
bool vis[100+1];
int tin[101], low[101];

void dfs(int v, int par){
    vis[v] = true;
    tin[v] = tin[par] + 1;
    low[v] = tin[v];
    
    for(int u: adj[v]){
        if(u==par || (tin[u]>tin[v]))
          continue;
          
        if(vis[u]){
            low[v] = min(tin[u], low[v]);
        }
        else{
            dfs(u, v);
        }
        low[v] = min(low[u], low[v]);
        
        if(edge[{v, u}]){
            ans[edge[{v, u}]]  = 1;
        }
        else{
            ans[edge[{u, v}]] = 2;
        }
    }
}


int main()
{
	IOS;
	
	int t=1; //cin>>t;
	while(t--){
	   cin>>n>>m;
	   adj.resize(n+1);
	   ans.resize(m+1);
	   
	   int a[m+1],b[m+1];
	   for(int i=1;i<=m;i++){
	       cin>>a[i]>>b[i];
	   }
	   for(int i=1;i<=n;i++) cin>>c[i];
	   
	   for(int i=1;i<=m;i++){
	       if(c[a[i]] > c[b[i]]) ans[i] = 1;
	       else if(c[a[i]] < c[b[i]]) ans[i] = 2;
	       else{
	           adj[a[i]].push_back(b[i]);
	           adj[b[i]].push_back(a[i]);
	           edge[{a[i], b[i]}] = i;
	       }
	   }
	   
	   for(int i=1;i<=n;i++){
	       if(!vis[i]){
	           dfs(i, 0);
	       }
	   }
	   for(int i=1;i<=m;i++){
	       if(ans[i]==1) cout<<"->\n";
	       else cout<<"<-\n";
	   }
	   //cout<<endl;
    }
    
}


