#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define rep(i, n) for(int i=0;i<n;i++)
#define all(i, v) for(auto& i : v)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int n, m;
vector<vector<pair<int, int> > > v;
vector<pair<int, int> > h;
vector<int> ans;
vector<int> c;

void dfs(int now){
    all(to, v[now]) if(!ans[to.second]){
        ans[to.second] = (h[to.second].first == now ? 1 : -1);
        dfs(to.first);
    }
}

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
  
    cin >> n >> m;
    v.resize(n);
    c.resize(n);
    ans.resize(m, 0);
  
    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        h.push_back({a, b});
        v[a].push_back({b, i});
        v[b].push_back({a, i});
    }
  
    rep(i, n) cin >> c[i];
    rep(i, n) all(to, v[i]) if(c[to.first] > c[i]) ans[to.second] = (h[to.second].first == i ? -1 : 1);
    rep(i, n){
        vector<int> s;
        all(to, v[i]) if(!ans[to.second] && c[i] == c[to.first]) s.pb(to.second);

        int maki = s.size();
        rep(to, maki){
            if(to == maki - 1) {
                if(h[s[to]].first == i){
                    ans[s[to]] = 1;
                    dfs(h[s[to]].second);
                }else{
                    ans[s[to]] = -1;
                    dfs(h[s[to]].first);
                }
            }else ans[s[to]] = (h[s[to]].first == i ? -1 : 1);
        }
    }
    rep(i, m) cout << (ans[i] == 1 ? "->" : "<-") << endl;
    return 0;
}



#include <bits/stdc++.h>

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<vector<int>> graph(N, vector<int>(N, 0));
  vector<array<int, 2>> edges(M);
  
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    
    ++graph[a][b];
    ++graph[b][a];
    edges[i] = {a, b};
  }
  
  vector<int> c(N);
  
  for (int i = 0; i < N; i++) cin >> c[i];
  
  vector<bool> used(N, false);
  
  for (int i = 0; i < N; i++) {
    stack<array<int, 2>> s;
    vector<bool> candidate(N, false);
    
    if (!used[i]) {
      s.push({i, -1});
      candidate[i] = true;
    }
    
    while (s.size()) {
      auto [node, parent] = s.top();
      
      bool exists = false;
      
      for (int next = 0; next < N; next++) {
        if (!graph[node][next] || used[next] || candidate[next]) continue;
        
        if (c[node] == c[next]) {
          exists = true;
          candidate[node] = true;
          s.push({next, node});
          break;
        }
      }
      
      if (!exists) {
        if (parent >= 0) {
          graph[node][parent] = 0;
        }
        
        for (int next = 0; next < N; next++) {
          if (!graph[node][next] || used[next]) continue;
          
          if (c[node] == c[next]) graph[next][node] = 0;
        }
        
        used[node] = true;
        s.pop();
      }
    }
    
    for (int j = 0; j < N; j++) {
      if (!graph[i][j]) continue;
      
      if (c[i] > c[j]) {
        graph[j][i] = 0;
      } else if (c[i] < c[j]) {
        graph[i][j] = 0;
      }
    }
  }
  
  for (int i = 0; i < M; i++) {
    if (graph[edges[i][0]][edges[i][1]]) cout << "->" << endl;
    else if (graph[edges[i][1]][edges[i][0]]) cout << "<-" << endl;
    else exit(1);
  }
}