#include "iostream"
#include "algorithm"
#include "cstring"
#include "cstdio"
#include "cmath"
#include "vector"
#include "map"
#include "set"
#include "queue"
using namespace std;
#define MAXN 206
//#define int long long
#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define all(x) (x).begin() , (x).end()
#define mem( a ) memset(a , 0 , sizeof a )
typedef long long ll;
#define fail return void( puts("-1") )
int n , m;

int c[MAXN];
int G[MAXN][MAXN];
vi g[MAXN];

int vis[MAXN];
set<pii> S;
void dfs( int u , int fa ) {
	vis[u] = vis[fa] + 1;
	for( int v : g[u] ) if( v != fa ) {
		if( !vis[v] ) S.insert( mp( v , u ) ) , dfs( v , u );
		else if( vis[v] < vis[u] ) S.insert( mp( v , u ) );// , cout << v << ' ' << u << endl;
	}
}

void solve() {
	cin >> n >> m;
	vector<pii> ff;
	rep( i , 1 , m ) {
		int u , v;
		scanf("%d%d",&u,&v);
		G[u][v] = 1;
		ff.eb( mp( u , v ) );
	}
	rep( i , 1 , n ) scanf("%d",c + i);
	rep( i , 1 , n ) rep( j , 1 , n ) if( G[i][j] ) {
		if( c[i] != c[j] ) {
			if( c[i] < c[j] ) G[i][j] = 0 , G[j][i] = 1;
		} else {
			g[i].pb( j ) , g[j].pb( i );
			G[i][j] = 0;
		}
	}
	rep( i , 1 , n ) if( !vis[i] ) dfs( i , i );
	for( auto t : ff ) {
		int u = t.fi , v = t.se;
		if( c[u] != c[v] ) {
			if( G[u][v] ) puts( "->" );
			else puts( "<-" );
		} else {
			if( S.count( mp( u , v ) ) ) puts("<-");
			else puts("->");
		}
	}
}

signed main() {
//    int T;cin >> T;while( T-- ) solve();
	solve();
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)

#define LOCAL 1;
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

template<typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last)
      out << ", ";
  }
  out << "]";
  return out;
}

template<typename F, typename S>
ostream& operator<< (ostream& out, const pair<F,S>& p) {
  out << "[" << p.first << ", " << p.second << "]";
  return out;
}

vector<int> c;
vector<pair<int,int>> c_idx;
vector<set<int>> g;
set<pair<int,int>> ed;


//0-indexed
struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  //木の根なら-(size of tree) それ以外は木の根のindexが入っている。
  bool unite(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {//xの方がでかい
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};
map<pair<int,int>,string> ans;
void dfs(int cv, UnionFind &uf, set<int> &cver, vector<bool> &used, map<int,int> &mp){
  // cout << cv << endl;
  used[mp[cv]] = true;
  for(auto nv:g[cv]){
    if(cver.count(nv) && !used[mp[nv]]){
      ans[{cv,nv}] = "->";
      used[mp[nv]]=true;
      dfs(nv,uf,cver,used,mp);
    }
    if(ans.count({cv,nv})==0 && ans.count({nv,cv})==0){      
      ans[{cv,nv}] = "->";
    }    
  }
}
void solve(vector<int> &cver){
  UnionFind uf(((int)cver.size()));
  map<int,int> mp;
  set<int> st;
  rep(i,cver.size()){
    st.insert(cver[i]);
  }
  rep(i,cver.size()){
    mp[cver[i]] = i;
  }
  for(auto i:cver){
    for(auto j:cver){
      if(i>=j) continue;
      if(ed.count({i,j})){
        uf.unite(mp[i],mp[j]);
      }
    }
  }
  vector<bool> used(cver.size(),false);
  rep(i,cver.size()){
    if(uf.root(i)==i){
      // dbg(i);
      dfs(cver[i],uf,st,used,mp);
    }
  }
  rep(i,cver.size()){
    for(auto nv:g[cver[i]]){
      if(st.count(nv)==0) ans[{cver[i],nv}] = "->";
      g[nv].erase(cver[i]);
    }
    g[cver[i]].clear();
  }
}



int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n,m;
  cin >> n >> m;
  c.resize(n);
  c_idx.resize(n);
  g.resize(n,set<int>());
  vector<pair<int,int>> inp;
  rep(i,m){
    int a,b;
    cin >> a >> b;
    --a;--b;
    g[a].insert(b);
    g[b].insert(a);
    ed.insert({min(a,b),max(a,b)});
    inp.push_back({a,b});
  }
  rep(i,n) cin >> c[i];
  rep(i,n) c_idx[i] = {c[i],i};
  sort(c_idx.rbegin(),c_idx.rend());
  // rep(i,n)dbg(c_idx[i]);
  rep(i,n){
    vector<int> cver = {c_idx[i].second};

    int ni = i+1;
    while(ni<n && c_idx[ni].first==c_idx[i].first){
      // dbg(c_idx[ni].second);
      cver.push_back(c_idx[ni].second);
      ni++;
    }
    // dbg(cver);
    i=ni-1;
    solve(cver);
  }
  rep(i,inp.size()){
    if(ans.count(inp[i])) cout << ans[inp[i]] << endl;
    else{
      if(ans.count({inp[i].second,inp[i].first})){
        cout << "<-" << endl;
      }
      // else{
      //   cout <<"->" << endl;
      // }
    }

  }


  return 0;
    

}
