/**
 *    author:  otera    
**/
#include<bits/stdc++.h>
using namespace std;

#define int long long
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60;
#define rep(i, n) for(int i = 0; i < n; ++ i)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
    int n, m; cin >> n >> m;
    vector<int> c(n);
    vector<vector<int>> g(n, vector<int>());
    vector<int> a(m), b(m);
    vector<int> ans(m, -1);
    map<P, P> mp;
    rep(i, m) {
        cin >> a[i] >> b[i]; -- a[i], -- b[i];
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
        mp[{a[i], b[i]}] = {i, 1}, mp[{b[i], a[i]}] = {i, 0};
    }
    rep(i, n) {
        cin >> c[i];
    }
    vector<bool> used(m, 0);
    rep(i, m) {
        if(c[a[i]] < c[b[i]]) {
            // <-
            ans[i] = 0;
            used[i] = 1;
        } else if(c[a[i]] > c[b[i]]) {
            // ->
            ans[i] = 1;
            used[i] = 1;
        }
    }
    auto rec = [&](auto && self, int p, int v) -> void {
        for(int nv: g[v]) {
            if(nv == p) continue;
            if(c[v] == c[nv]) {
                // v -> nv
                if(mp.count({v, nv})) {
                    P p = mp[{v, nv}];
                    int i = p.fr, val = p.sc;
                    if(used[i]) continue;
                    used[i] = 1;
                    ans[i] = val;
                    self(self, v, nv);
                }
            }
        }
    };
    rep(i, m) {
        if(!used[i]) {
            assert(c[a[i]] == c[b[i]]);
            used[i] = 1;
            ans[i] = 1;
            rec(rec, a[i], b[i]);
        }
    }
    rep(i, m) {
        assert(ans[i] != -1);
        if(ans[i] == 1) cout << "->" << "\n";
        else cout << "<-" << "\n";
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(20);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}
//#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4", "avx")

#ifdef __APPLE__
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_map>
# include <unordered_set>
# include <thread>
#else
# include <bits/stdc++.h>
#endif

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define mp make_pair
#define pb push_back
#define fir first
#define sec second

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

const int max_n = 100+10, inf = 1000111222;

vector<int> reb[max_n];
int c[max_n];
bool use[max_n];

bool ans[max_n][max_n];

void dfs(int now)
{
    use[now]=1;
    for (auto wh:reb[now]){
        if (c[now]==c[wh]){
            if (!ans[now][wh] && !ans[wh][now]){
                ans[now][wh]=1;
            }
            if (!use[wh]){
                dfs(wh);
            }
        }
    }
}

int main() {
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    int n,m;
    cin>>n>>m;
    vector<pii> edges;
    for (int i=1;i<=m;i++){
        int a,b;
        cin>>a>>b;
        reb[a].pb(b);
        reb[b].pb(a);
        edges.pb(mp(a,b));
    }
    for (int i=1;i<=n;i++){
        cin>>c[i];
    }
    for (auto& i:edges){
        if (c[i.fir]>c[i.sec]){
            ans[i.fir][i.sec]=1;
        }
        swap(i.fir,i.sec);
        if (c[i.fir]>c[i.sec]){
            ans[i.fir][i.sec]=1;
        }
        swap(i.fir,i.sec);
    }
    for (int i=1;i<=n;i++){
        if (!use[i]){
            dfs(i);
        }
    }
    for (auto i:edges){
        if (ans[i.fir][i.sec]){
            cout<<"->"<<"\n";
        }
        else{
            cout<<"<-"<<"\n";
        }
    }
}
