#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1e5 + 5;

int N, M;
int a[MAXN][2];
vector <pair <int, int>> adj[MAXN];
int bio[MAXN], ans[MAXN];
int c[MAXN];

void load() {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < M; i++)
    for (int j = 0; j < 2; j++)
      scanf("%d", a[i] + j);
  for (int i = 1; i <= N; i++)
    scanf("%d", c + i);
}

void dfs(int x, int p) {
  bio[x] = 1;
  for (auto it : adj[x]) {
    int nxt = a[it.first][it.second];
    if (nxt == p || bio[nxt] == 2)
      continue;
    ans[it.first] = it.second;
    if (!bio[nxt])
      dfs(nxt, x);
  }
  bio[x] = 2;
}

void solve() {
  for (int i = 0; i < M; i++)
    if (c[a[i][0]] != c[a[i][1]])
      ans[i] = c[a[i][0]] > c[a[i][1]];
    else
      for (int j = 0; j < 2; j++)
        adj[a[i][j]].push_back({i, j ^ 1});
  for (int i = 1; i <= N; i++)
    if (!bio[i])
      dfs(i, 0);
  for (int i = 0; i < M; i++)
    printf("%s\n", ans[i] ? "->" : "<-");
}

int main() {
  load();
  solve();
  return 0;
}
#include<bits/stdc++.h>
using namespace std;
int n,m;
vector<vector<int>>a;
vector<pair<int,int>>ds;
int b[104][104];
const int nmax=1e6;
int c[nmax+4];
int mau[105];
int cha[105];
int hang[105];
vector<pair<int,int>>kq;
void dfs(int u)
{
    mau[u]=1;
    for(int i=0; i<a[u].size(); ++i)
    {
        int v=a[u][i];
        //   cout<<v<<' ';
        if(!mau[v]&&c[u]==c[v])
        {
            b[u][v]=1;
            cha[v]=u;
            hang[v]=hang[u]+1;
            dfs(v);
        }

    }
}
int main()
{
    //ifstream cin("chuyen.inp");
    //ofstream cout("chuyen.out");
    cin>>n>>m;
    a.assign(n+1,vector<int>());
    for(int i=1; i<=m; ++i)
    {
        int x,y;
        cin>>x>>y;
        a[x].push_back(y);
        a[y].push_back(x);
        kq.push_back({x,y});
    }
    for(int i=1; i<=n; ++i)
    {
        cin>>c[i];
        ds.push_back({c[i],i});
    }

    for(int i=1; i<=n; ++i)
    {
        if(!mau[i])
            dfs(i);
    }

    for(int i=0; i<m; ++i)
    {
        int x=kq[i].first;
        int y=kq[i].second;
        if(c[x]==c[y])
        {
            if(cha[y]==x||(cha[x]!=y&&hang[x]>hang[y]))
                cout<<"->"<<'\n';
            else
                cout<<"<-"<<'\n';
            //continue;
        }
        else
        {
            if(c[x]>c[y])
                cout<<"->"<<'\n';
            else
                cout<<"<-"<<'\n';
        }
    }



}
