#include <bits/stdc++.h>
#define fir first
#define sec second
#define PB push_back
#define MP make_pair

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i < (int)(n); ++i)
#define foreach(itr, c) for (__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); ++itr)

template <class T> void chkmax(T& x, T y) { x = (x > y ? x : y); }
template <class T> void chkmin(T& x, T y) { x = (x < y ? x : y); }

typedef long long LL;
typedef pair <int, int> pii;
typedef vector <int> vi;

const int N = 105;
const int M = 1e4 + 5;

int n, m, a[M], b[M], c[N];
vi e[N];
set <int> e2[N];
bool vis[N];

void dfs(int now, int from){
    vis[now] = 1;
    for (auto u : e[now]) if (u != from && c[u] == c[now]){
        if (e2[u].find(now) != e2[u].end()) continue;
        e2[now].insert(u);
        if (!vis[u]) dfs(u, now);
    }
}

int main(){
    scanf("%d%d", &n, &m);
    rep(i, m){
        scanf("%d%d", &a[i], &b[i]), a[i]--, b[i]--;
        e[a[i]].PB(b[i]);
        e[b[i]].PB(a[i]);
    }
    rep(i, n) scanf("%d", &c[i]);
    rep(i, m){
        if (c[a[i]] > c[b[i]]) e2[a[i]].insert(b[i]);
        else if (c[a[i]] < c[b[i]]) e2[b[i]].insert(a[i]);
        else {
            if (e2[a[i]].find(b[i]) != e2[a[i]].end() || e2[b[i]].find(a[i]) != e2[b[i]].end())
                continue;
            dfs(b[i], a[i]);
        }
    }

    rep(i, m){
        if (e2[a[i]].find(b[i]) != e2[a[i]].end()) printf("->\n");
        else printf("<-\n");
    }
    return 0;
}
#include <bits/stdc++.h>
// #define int long long
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ti tuple<int, int, int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define teto(a, b) (((a)+(b)-1)/(b))
#define all(x) x.begin(), x.end()
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define dbg(msg, var) cerr << msg << " " << var << endl;
 
using namespace std;
 
const int MAX = 200010;
const ll MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-8;
const ld PI = acos(-1);

// End Template //

int c[MAX];
bool ans[MAX];
vi alc(MAX, 1);
vector<vi> g(MAX);
bool visto[MAX];
map<pii, pii> edg; // (a,b) -> (direita, idx)

void dfs(int u){
    if(visto[u]) return;
    visto[u]=true;
    for(auto v: g[u]){
        // if(visto[v]){
        //     pii e = mm[{}];
        // }else{

        // }
        pii e = edg[{u, v}];
        ans[e.ss] = e.ff;
        dfs(v);
    }
}

int32_t main()
{sws;

    int n, m, u, v;
    cin >> n >> m;
    vii ee;
    for(int i=0;i<m;i++){
        cin >> u >> v; u--;v--;
        ee.pb({u, v});
    }
    for(int i=0;i<n;i++)
        cin >> c[i];

    for(int i=0;i<m;i++){
        int u=ee[i].ff, v=ee[i].ss;
        if(c[u]!=c[v]){
            ans[i] = (c[u] > c[v]);
            continue;
        }
        g[u].pb(v);
        g[v].pb(u);
        edg[{u, v}] = {1, i};
        edg[{v, u}] = {0, i};
    }

    for(int i=0;i<n;i++)
        if(!visto[i])
            dfs(i);
    

    // output
    for(int i=0;i<m;i++){
        if(ans[i])
            cout << "->\n";
        else
            cout << "<-\n";
    }



    return 0;
}