#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define mp make_pair
#define ll long long
#define pb push_back
#define INF 1e6
vector<int>ans,a,b;

void dfs(int u, vector<int>&visited, vector<vector<pair<int,int> >>&adj)
{
    visited[u]  =1;
    for(auto p:adj[u])
    {
        int v = p.first;
        int id = p.second;
        if(a[id] == u && b[id]==v)ans[id] = 1;
        if(a[id] == v && b[id]==u)ans[id] = -1;
        if(!visited[v])dfs(v,visited,adj);
    }
}



void solve(int test)
{
   int n,m;
   cin>>n>>m;

   a.resize(m);
   b.resize(m);
   int i,j;
   vector<vector<pair<int,int> >>adj(n);
   for(i=0;i<m;i++){cin>>a[i]>>b[i];a[i]--;b[i]--;}

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

   ans.resize(m,0);

   for(i=0;i<m;i++)
   {
       if(c[a[i]] > c[b[i]]){ans[i] = 1;continue;}
       if(c[a[i]] < c[b[i]]){ans[i] = -1;continue;}
       adj[a[i]].pb(mp(b[i],i));
       adj[b[i]].pb(mp(a[i],i));
   }
   vector<int>visited(n,0);

   for(i=0;i<n;i++)
   {
       if(!visited[i])dfs(i,visited,adj);
   }

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

}

int main()
{
  int t = 1;
  //cin>>t;

  for(int x=1;x<=t;x++)
  {
      solve(x);
  }
  return 0;
}




#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

//#include <atcoder/all>
//using namespace atcoder;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, y) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), y))
#define Upper_bound(v, y) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), y))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

/* Macros reg. ends here */

struct UnionFind {
  vector<ll> par, sizes;
  ll cnt;
  UnionFind(ll N) : par(N), sizes(N, 1), cnt(N) {
    for (ll i = 0; i < N; i++) par[i] = i;
  }

  ll find(ll x) { return par[x] == x ? x : par[x] = find(par[x]); }

  bool same(ll x, ll y) { return find(x) == find(y); }

  ll size(ll x) { return sizes[find(x)]; }

  void unite(ll x, ll y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (sizes[x] < sizes[y]) swap(x, y);
    par[y] = x;
    sizes[x] += sizes[y];
    cnt--;
  }

  ll count() const { return cnt; }
};

const ll INF = 1LL << 50;

using vvT = vector<vT>;
vll ans;
vvT to;
vector<bool> seen;

void dfs(ll u){
  if(seen[u]) return;
  seen[u] = true;
  for(auto [id, v, dir] : to[u]){
    if(ans[id] != -1) continue;
    ans[id] = dir;
    dfs(v);
  }
}

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n, m;
  cin >> n >> m;

  ans.assign(m, -1);
  to.resize(n);
  seen.resize(n);
  rep(i, m){
    ll a, b;
    cin >> a >> b;
    a--, b--;
    to[a].emplace_back(i, b, 0);
    to[b].emplace_back(i, a, 1);
  }

  vll cs(n);
  rep(i, n) cin >> cs[i];

  rep(u, n){
    for(auto [id, v, dir] : to[u]){
      if(cs[u] > cs[v]) {
        assert(ans[id] == -1);
        ans[id] = dir;
      }
    }
  }

  rep(u, n) dfs(u);

  rep(i, m) cout << ((ans[i] == 0) ? "->" : "<-") << endl;

  return 0;
}
