#include <bits/stdc++.h>

using namespace std;

vector<vector<pair<int, int>>> graph; // {nxt, eid}
vector<pair<int, int>> elist; // edges, in orientation in input
vector<bool> marked, exited;
vector<bool> toDirectForward;

void direct(int eid, int i, int j) {
//    printf("directing %d %d->%d\n", eid, i, j);
    toDirectForward[eid] = (elist[eid].first == i);
}

void directForSCC(int v, int p, vector<bool> &pwede) {
    if (!pwede[v] || marked[v]) return;
    marked[v] = true;
//    printf("submarking %d %d\n", v, p);
    for (auto [nxt, eid] : graph[v]) {
        if (!pwede[nxt]) continue;
        if (marked[nxt]) {
            if (nxt != p && !exited[nxt]) direct(eid, v, nxt);
        } else {
            direct(eid, v, nxt);
            directForSCC(nxt, v, pwede);
        }
    }
    exited[v] = true;
}

int main() {
    int n, m; scanf("%d %d", &n, &m);
    graph.assign(n, vector<pair<int, int>>());
    marked.assign(n, false);
    exited.assign(n, false);
    toDirectForward.assign(m, false);
    for (int i = 0; i < m; ++i) {
        int a, b; scanf("%d %d", &a, &b);
        elist.emplace_back(--a, --b);
        graph[a].emplace_back(b, i);
        graph[b].emplace_back(a, i);
    }
    vector<int> c(n);
    for (int i = 0; i < n; ++i) scanf("%d", &c[i]);

    // while i have edges i haven't figured out:
    while (!all_of(begin(marked), end(marked), [&] (bool b) {return b;})) {
//        printf("!NEW SET\n");
        // consider the set of vertices with the lowest c_i. 
        int min_ci = n + 1;
        for (int i = 0; i < n; ++i) if (!marked[i]) min_ci = min(min_ci, c[i]);
        vector<int> toCheck;
        vector<bool> canVisit(n, false);
        for (int i = 0; i < n; ++i) if (!marked[i] && c[i] == min_ci) {
            toCheck.push_back(i);
            canVisit[i] = true;
        }
        // consider the connected components this set defines in G
        // for each CC:
            // direct all vertices internally to create an SCC
            // for (u, v) such that u hasn't been marked, and v is in this CC, u->v
            //
            // mark all vertices in the CC
        for (int v : toCheck) directForSCC(v, -1, canVisit);
        for (int i = 0; i < m; ++i) {
            auto [u, v] = elist[i];
            if (!marked[u] && canVisit[v]) direct(i, u, v);
            if (!marked[v] && canVisit[u]) direct(i, v, u);
        }
    }
    for (int i = 0; i < m; ++i) {
        if (toDirectForward[i]) printf("->\n");
        else printf("<-\n");
    }
}

#include <bits/stdc++.h>
//#include <chrono>
#pragma GCC optimize("Ofast")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}
template<class T> void my_printv(std::vector<T> v,bool endline = true){
    if(!v.empty()){
        for(std::size_t i{}; i<v.size()-1; ++i) std::cout<<v[i]<<" ";
        std::cout<<v.back();
    }
    if(endline) std::cout<<std::endl;
}

struct edge{
        int to, id;
        bool rev;
        edge(){}
        edge(int a, int b, bool c) : to(a), id(b), rev(c){}
    };

vec a(10000), b(10000), c(100);
bitset<10000> res(0), used(0);
vector<vector<edge> > G(100);

void dfs(int v){
    for(edge &e : G[v]){
        if(!used[e.id]){
            used[e.id] = true;
            res[e.id] = e.rev;
            dfs(e.to);
        }
    }
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>N>>M;
    rep(i, M) {
        cin>>a[i]>>b[i];
        --a[i]; --b[i];
        G[a[i]].emplace_back(b[i], i, false);
        G[b[i]].emplace_back(a[i], i, true);
    }
    rep(i, N) cin>>c[i];
    rep(i, M) {
        if(c[a[i]] != c[b[i]]){
            used[i] = true;
            res[i] = (c[a[i]] < c[b[i]]);
        }
    }
    rep(i, N) dfs(i);
    rep(i, M) cout<<(res[i] ? "<-" : "->")<<endl;
}
