#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#define itrout(x) for(int i=0;i<x.size();i++) {cout << x[i] << (i==x.size()-1 ? "\n" : " ");}
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define debugbit(x, n) cerr << #x << " = " << bitset<n>(x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define debugbit(x, n)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long
//using mint = atcoder::modint;

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, long long M, std::vector<long long> a, std::vector<long long> b, std::vector<long long> c){
    struct Edge {
        int index, to;
    };
    vector<vector<Edge>> edges(N+1);
    rep(i,0,M) {
        edges[a[i]].push_back(Edge{(int)i, (int)b[i]});
        edges[b[i]].push_back(Edge{(int)i, (int)a[i]});
    }
    vector<string> answer(M);
    vector<int> visited(N+1, false);
    auto dfs = [&](auto&& self, int current) -> void {
        visited[current] = true;
        for (const auto& [edgeIndex, next] : edges[current]) {
            if (c[current] != c[next]) continue;
            if (next == b[edgeIndex]) {
                answer[edgeIndex] = "->";
            } else {
                answer[edgeIndex] = "<-";
            }
            if (visited[next]) continue;
            self(self, next);
        }
    };
    rep(i,1,N+1) {
        if (visited[i]) continue;
        dfs(dfs, i);
    }
    rep(i,0,M) {
        if (c[a[i]] > c[b[i]]) cout << "->" << endl;
        else if (c[a[i]] < c[b[i]]) cout << "<-" << endl;
        else {
            cout << answer[i] << endl;
        }
    }
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> a(M);
    std::vector<long long> b(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    std::vector<long long> c(N+1);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&c[i+1]);
    }
    solve(N, M, std::move(a), std::move(b), std::move(c));
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int N; cin>>N;
    int M; cin>>M;
    vec_int a(M);
    vec_int b(M);
    rep(i,M)cin>>a.at(i)>>b.at(i);
    vec_int c(N); rep(i,N)cin>>c.at(i);
    vector<vec_int> G(N+1);
    rep(i,M){
        G.at(a.at(i)).push_back(b.at(i));
        G.at(b.at(i)).push_back(a.at(i));
    }
    map<P, int> path_map;
    rep(i, M){
        path_map[make_pair(a.at(i), b.at(i))] = i;
        path_map[make_pair(b.at(i), a.at(i))] = i;
    }
    vector<string> ans(M,"");
    rep(i,M){
        if(c.at(a.at(i)-1)>c.at(b.at(i)-1)){
            ans.at(i) = "->";
        }else if(c.at(a.at(i)-1)<c.at(b.at(i)-1)){
            ans.at(i) = "<-";
        }
    }

    rep(i,M){
        if(ans.at(i)==""){
            vec_int visited(N+1, 0);
            visited.at(a.at(i)) =1;
            stack<P> st;
            st.push(make_pair(b.at(i), a.at(i))); // node, parent
            int node_val = c.at(a.at(i)-1);
            while(!st.empty()){
                int node = st.top().first;
                int parent = st.top().second;
                st.pop();
                int ind = path_map[make_pair(parent, node)];
                if(ans.at(ind)!="")continue;
                if(a.at(ind)==parent && b.at(ind)==node){
                    ans.at(ind) = "->";
                }else{
                    ans.at(ind) = "<-";
                }
                for(auto next_node: G.at(node)){
                    if(next_node==parent)continue;
                    if(c.at(next_node-1)!=node_val)continue;
                    st.push(make_pair(next_node, node));
                }
            }
        }
    }
    rep(i,M){
        cout<<ans.at(i)<<endl;
    }







    return 0;
}