#include <vector>
#include <set>
#include <iostream>
#include <algorithm>
#define MAX 100000000
#define ll long long
using namespace std;

bool decide(int n,vector<vector<int>> g,vector<int> v){
  int p = v.size();
  for(int i = 0;i < p;i ++){
    if(g[n][v[i]] == g[v[i]][n]){
      return true;
    }
  }
  return false;
}

int main() {
  int num;
  cin >> num;
  int mem;
  cin >> mem;
  vector<vector<int>> edge(mem);
  vector<vector<int>> vert(num);
  vector<vector<int>> graph(num,vector<int>(num,0));
  for(int i = 0;i < mem;i ++){
    int a,b;
    cin >> a;
    cin >> b;
    a--;
    b--;
    graph[a][b] = 1;
    graph[b][a] = 1;
    edge[i] = {a,b};
    vert[a].push_back(b);
    vert[b].push_back(a);
  }
  vector<int> need(num);
  for(int i = 0;i < num;i ++){
    cin >> need[i];
  }
  for(int i = 0;i < mem;i ++){
    if(need[edge[i][0]] != need[edge[i][1]]){
      if(need[edge[i][0]] > need[edge[i][1]]){
        graph[edge[i][1]][edge[i][0]] = 0;
      }else{
        graph[edge[i][0]][edge[i][1]] = 0;
      }
    }
  }
  for(int i = 0;i < mem;i ++){
    if(decide(edge[i][0],graph,vert[edge[i][0]])){
      vector<int> tree;
      int m = need[edge[i][0]];
      vector<int> next = {edge[i][0]};
      vector<bool> alr(num,false);
      while(not next.empty()){
        vector<int> newn;
        int p = next.size();
        for(int j = 0;j< p;j ++){
          if(alr[next[j]] == false and need[next[j]] == m){
            tree.push_back(next[j]);
            alr[next[j]] = true;
            newn.insert(newn.end(),vert[next[j]].begin(),vert[next[j]].end());
            
          }
        }
        next = newn;
      }
      int root = tree[0];
      int s = tree.size();
      vector<int> road = {root};
      vector<bool> alre(num,false);
      alre[root] = true;
      while(not road.empty()){
        int d = road.size();
        /*
        for(int j = 0;j < d;j ++){
          cout<< road[j]+1 << ' ';
        }
        cout << endl;*/
        int prev = road[d-1];
        vector<int> nex = vert[prev];
        d = nex.size();
        for(int j = 0;j < d;j ++){
          if(alre[nex[j]] == true and m == need[nex[j]]){
            if(graph[prev][nex[j]] == 1 and graph[nex[j]][prev] == 1){
              graph[nex[j]][prev] = 0;
              /*cout << 'a' << nex[j]+1 << endl;*/
            }
            /*cout << '@' << endl;*/
          }else if(alre[nex[j]] == false and m == need[nex[j]]){
            road.push_back(nex[j]);
            alre[nex[j]] = true;
            /*cout << 'b' << endl;*/
            graph[nex[j]][prev] = 0;/*もともとは0*/
            break;
          }
        }
        
        if(prev == road.back()){
          road.pop_back();
        }
      }
      for(int j = 0;j < s;j ++){
        vector<int> exp = vert[tree[j]];
        int d = exp.size();
        for(int k = 0;k < d;k ++){
          if(graph[tree[j]][exp[k]] == graph[exp[k]][tree[j]]){
            graph[exp[k]][tree[j]] = 0;
          }
        }
                            
      }
    }
  }
  for(int i = 0;i < mem;i ++){
    /*cout << edge[i][0]+1 << ' ' << edge[i][1]+1 << endl;*/
    if(graph[edge[i][0]][edge[i][1]]  == 1 and graph[edge[i][1]][edge[i][0]] == 0){
      cout << "->" << endl;
    }else if(graph[edge[i][1]][edge[i][0]] == 1 and graph[edge[i][0]][edge[i][1]] == 0){
      cout << "<-" << endl;
    }else if(graph[edge[i][0]][edge[i][1]] == 0){
      cout << "errorzero" << endl;
    }else{
      cout << "erroeone" << endl;
    }
  }
  
  
  


   
    return 0;
}
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
vector<vector<pair<int, int>>> v;
vector<bool> bl;
vector<int> depth, c;
vector<str> dir;
vector<pair<int, int>> edges;
void dfs(int nd, int h, int e_id){
    if(bl[nd]) return;
    bl[nd] = 1;
    depth[nd] = h;
    if(e_id == 0){
        //do nothing
    }
    else if(e_id > 0){
        dir[e_id-1] = "->";
    }
    else{
        e_id*=-1;
        e_id--;
        dir[e_id] = "<-";
    }
    for(auto [x, id]: v[nd]) if(c[x] == c[nd]) dfs(x, h+1, id);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m; cin >> n >> m;
    v.resize(n), bl.resize(n, 0), depth.resize(n, -1), c.resize(n), dir.resize(m, "<->");
    for(int i = 0; i < m; i++){
        int a, b; cin >> a >> b; a--, b--;
        v[a].pb({b, i+1});
        v[b].pb({a, -(i+1)});
        edges.pb({a, b});
    }
    for(int &x: c) cin >> x;
    for(int i = 0; i < n; i++) if(!bl[i]) dfs(i, 0, 0);
    for(int i = 0; i < m; i++){
        if(dir[i] != "<->") continue;
        auto [a, b] = edges[i];
        if(c[a] > c[b]) dir[i] = "->";
        else if(c[b] > c[a]) dir[i] = "<-";
        else if(depth[a] > depth[b]) dir[i] = "->";
        else dir[i] = "<-";
    }
    for(str s: dir) cout << s << "\n";
}