#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>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> edges(m);
    vector<vector<int>> g(n);
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        edges[i] = {x, y};
        g[x].emplace_back(i);
        g[y].emplace_back(i);
    }
    vector<int> c(n);
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    }
    vector<int> ans(m, -1);  // 0 "->" , 1 "<-"
    for (int i = 0; i < m; i++) {
        if (c[edges[i].first] > c[edges[i].second]) {
            ans[i] = 0;
        } else if (c[edges[i].first] < c[edges[i].second]) {
            ans[i] = 1;
        }
    }
    vector<int> done(n);
    for (int i = 0; i < m; i++) {
        if (ans[i] == -1) {
            if (done[edges[i].first] && done[edges[i].second]) {
                continue;
            }
            set<int> st;
            int root = edges[i].first;
            if (done[edges[i].second]) {
                root = edges[i].second;
            }
            done[root] = 1;
            st.emplace(root);
            function<bool(int)> dfs = [&](int v) {
                for (int id : g[v]) {
                    if (ans[id] == -1) {
                        int to = v ^ edges[id].first ^ edges[id].second;
                        if (v == edges[id].first) {
                            ans[id] = 0;
                        } else {
                            ans[id] = 1;
                        }
                        if (done[to] || dfs(to)) {
                            st.emplace(v);
                            done[v] = 1;
                            return true;
                        }
                        ans[id] = -1;
                    }
                }
                return false;
            };
            while (true) {
                bool ok = false;
                for (int t : st) {
                    if (dfs(t)) {
                        ok = true;
                    }
                }
                if (!ok) {
                    break;
                }
            }
        }
    }
    debug(ans);
    for (int i = 0; i < m; i++) {
        if (ans[i] == 0) {
            cout << "->" << '\n';
        } else {
            cout << "<-" << '\n';
        }
    }
    return 0;
}