#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define bit(n,k) ((n>>k)&1) //nのk　bit目
#define vec(T) vector<T>
#define vvec(T) vec(vec(T))
using ll = long long;
using P = pair<int,int>;

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; }
const ll llINF = 1LL << 60;
const int iINF = 1e9;

//------------------------------------------------

struct path{
    int to,id,dir;
    path(int to=0, int id=0, int dir=0):to(to),id(id),dir(dir){}
};


struct Solver{
    vec(int) ans;
    vvec(path) ps;
    
    void dfs(int now){
        for(auto psi:ps[now]){
            if(ans[psi.id]!=-1) continue;
            ans[psi.id]=psi.dir;
            dfs(psi.to);
        }
    }
    
    void solve(){
        int N,M;
        cin >> N >> M;

        vec(P) ed(M);
        ps = vvec(path)(N);
        rep(i,M){
            int a,b;
            cin >> a >> b;
            --a; --b;
            ed[i]=P(a,b);
            ps[a].emplace_back(b,i,0);
            ps[b].emplace_back(a,i,1);
        }

        vec(int) C(N);
        rep(i,N) cin >> C[i];

        ans = vec(int)(M,-1);
        rep(i,M){
            int a=ed[i].first;
            int b=ed[i].second;
            if(C[a]>C[b]) ans[i]=0;
            if(C[a]<C[b]) ans[i]=1;
        }

        rep(i,N) dfs(i);

        rep(i,M) cout << (ans[i]?"<-":"->") << endl;
    }
};


int main(){
    int testcasenum=1;
    //cin >> testcasenum;
    rep1(ti,testcasenum){
        Solver solver;
        solver.solve();
    }
    return 0;
}
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl
#define maxn 3e5+50

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long ,long long>pll;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
ll lcm(ll a, ll b) {return ((a*b)/gcd(a,b));}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

 long long modpow(long long n, long long k,long long mod)
{
if (k == 0) return 1;
long long r = modpow(n * n % mod, k >> 1, mod);
if (k & 1) r = r * n % mod;
return r;
}

vector<vector<pii>>adj(maxn);
vector<bool>vis(maxn,0),have(maxn,0);
vector<int>a(maxn),b(maxn),c(maxn),ans(maxn,0);
void dfs(int v){
   vis[v] = 1;
   for(auto i:adj[v]){
      int u = i.first,idx = i.second;
      if(have[idx]) continue;
      have[idx] = 1;
      if(u == b[idx]) ans[idx] = 1;
      dfs(u);
   }
}

void solve(){
    int n,m;cin >> n >> m;
    for(int i = 0;i<m;i++) cin >> a[i] >> b[i];
    for(int i = 1;i<=n;i++) cin >> c[i];
    for(int i = 0;i<m;i++){
        if(c[a[i]]>c[b[i]]) ans[i] = 1;
        else if(c[a[i]]==c[b[i]])
        {
           int v = a[i],u = b[i];
           adj[v].push_back({u,i});
           adj[u].push_back({v,i});
        }
    }
    for(int i = 1;i<=n;i++){
        if(!vis[i]) dfs(i);
    }
    for(int i = 0;i<m;i++){
        if(ans[i]) cout << "->" <<'\n';
        else cout << "<-" <<'\n';
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}
