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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()

struct P{int to,idx;};
vector<vector<P>> edge;
vector<int> a,b;
vector<string> ans;
const string R="->",L="<-";
vector<int> used;

bool dfs(int from,int idx,int goal,int num){
  used[idx]=num;
  for(P p:edge[idx]){
    if(idx==goal)return true;
    if((ans[p.idx]==R&&a[p.idx]!=idx)||(ans[p.idx]==L&&b[p.idx]!=idx))continue;
    if(p.to==from)continue;
    if(used[p.to]==num)continue;
    if(dfs(idx,p.to,goal,num)){
      if(ans[p.idx]=="#"){
        if(a[p.idx]==idx&&b[p.idx]==p.to)ans[p.idx]=R;
        else if(b[p.idx]==idx&&a[p.idx]==p.to)ans[p.idx]=L;
      }
      return true;
    }
  }
  return false;
}

signed main(){
  int n,m;cin>>n>>m;
  edge.resize(n);
  a.resize(m);
  b.resize(m);
  vector<int> c(n);
  REP(i,m)cin>>a[i]>>b[i];
  REP(i,m)a[i]--;
  REP(i,m)b[i]--;
  REP(i,n)cin>>c[i];
  used.resize(n,-1);
  ans.resize(m,"#");
  REP(i,m){
    if(c[a[i]]>c[b[i]]){
      ans[i]=R;
      edge[a[i]].push_back({b[i],i});
    }
    else if(c[a[i]]<c[b[i]]){
      ans[i]=L;
      edge[b[i]].push_back({a[i],i});
    }
    else{
      edge[a[i]].push_back({b[i],i});
      edge[b[i]].push_back({a[i],i});
    }
  }
  REP(i,m){
    if(ans[i]!="#")continue;
    if(dfs(b[i],a[i],b[i],2*i))ans[i]=L;
    else{
      dfs(a[i],b[i],a[i],2*i+1);
      ans[i]=R;
    }
  }
  REP(i,m)cout<<ans[i]<<endl;
}

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

struct edge{ int to, id, orientation; };
vector<vector<edge>> graph;
vector<int> ans;

void DFS(int v){
    for(edge e : graph[v]){
        if(ans[e.id] != 0) continue;

        ans[e.id] = e.orientation;
        DFS(e.to);
    }
}

int main(){
    int n, m;
    cin >> n >> m;

    vector<int> a(m), b(m), c(n);
    for(int i=0; i<m; i++) cin >> a[i] >> b[i];
    for(int i=0; i<n; i++) cin >> c[i];

    graph.resize(n);
    ans.resize(m);
    for(int i=0; i<m; i++){
        a[i] -= 1;
        b[i] -= 1;
        
        graph[a[i]].push_back({b[i],i,+1});
        graph[b[i]].push_back({a[i],i,-1});

        if(c[a[i]] > c[b[i]]) ans[i] = +1;
        if(c[a[i]] < c[b[i]]) ans[i] = -1;
    }

    for(int i=0; i<n; i++) DFS(i);

    for(int i=0; i<m; i++){
        if(ans[i] == +1) cout << "->" << endl;
        if(ans[i] == -1) cout << "<-" << endl;
    }
    return 0;
}