#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); ++ i)
#define per(i, a, b) for(int i = (a); i >= (b); -- i)
#define pb push_back
#define Pii pair<int,int> 
#define fi first
#define se second
typedef double db;
typedef long long ll;
 
using namespace std;
 
const ll N = 110;
const ll P = 998244353;

int n, m;
int a[N*N],b[N*N],c[N],vis[N],col[N][N],dep[N];
vector<int>G[N];
void dfs(int u, int cc,int pa) {
  vis[u] = 1;
  dep[u] = dep[pa] + 1;
  for(int v: G[u])if(!vis[v]&&c[v]==cc){
    // cout << u << " " << v << "\n";
    dfs(v,cc,u);
    col[u][v] = 1;
  } else if(vis[v]&&c[v]==cc&&dep[v]+1<dep[u]) {
    col[u][v] = 1;
    // cout << u << " " << v << "\n";
  }
}

signed main () {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n>>m;
  rep(i,1,m) cin >> a[i] >> b[i], G[a[i]].pb(b[i]), G[b[i]].pb(a[i]);
  rep(i,1,n) cin >> c[i];
  rep(i, 1, n) if(!vis[i]) {
    dfs(i,c[i],0);
  }
  rep(i,1,m) {
    if(c[a[i]]>c[b[i]]) cout << "->\n";
    else if(c[a[i]]<c[b[i]]) cout <<"<-\n";
    else {
      cout << (col[a[i]][b[i]] ? "->\n" : "<-\n");
    }
  }
}

#include <bits/stdc++.h>
using namespace std;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vb = vector<bool>;
VVi tree;
int depth[110];
int par[110];
int done[110];
void dfs(int u, const VVi& gr, Vb& ex) {
  for (int v : gr[u]) {
    if (!ex[v]) {
      ex[v] = true;
      par[v] = u;
      tree[u][v] = 1;
      tree[v][u] = -1;
      depth[v] = depth[u] + 1;
      dfs(v, gr, ex);
    }
  }
  done[u] = 1;
}
int main () {
  int N, M;
  cin >> N >> M;
  Vi A(M);
  Vi B(M);
  Vi count(N + 1);
  tree.assign(N + 1, Vi(N + 1, -2));
  for (int i = 0; i < M; i ++) {
    int a, b;
    cin >> a >> b;
    tree[a][b] = tree[b][a] = 0;
    A[i] = a;
    B[i] = b;
  }
  for (int i = 1; i <= N; i ++) {
    cin >> count[i];
  }
  VVi same(N + 1);
  for (int i = 1; i <= N; i ++) {
    done[i] = 1;
  }
  for (int i = 1; i <= N; i ++) {
    for (int j =1; j <= N; j ++) {
      if (tree[i][j] == 0) {
        if (count[i] > count[j]) {
          tree[i][j] = 1;
          tree[j][i] = -1;
        } else if (count[j] > count[i]) {
          tree[j][i] = 1;
          tree[i][j] = -1;
        } else {
          same[i].push_back(j);
          same[j].push_back(i);
          done[i] = done[j] = 0;
        }
      }
    }
  }
  //cout << tree[4][4] << endl;
  for (int i = 1; i <= N; i ++) {
    if (!done[i]) {
      Vb ex(N + 1, false);
      ex[i] = true;
      depth[i] = 0;
      par[i] = 0;
      dfs(i, same, ex);
    }
  }
  for (int i = 1; i <= N; i ++) {
    for (int j = 1; j <= N; j ++) {
      if (tree[i][j] == 0) {
        int pk = 1;
        if (depth[i] < depth[j]) pk = -1;
        tree[i][j] = pk;
        tree[j][i] = -pk;
      }
    }
  }
  for (int i = 0; i < M; i ++) {
    if (tree[A[i]][B[i]] == 1) {
      cout << "->" << endl;
    } else {
      cout << "<-" << endl;
    }
  }
}