#include<bits/stdc++.h>
using namespace std;
const int N = 1e2+10;
const int M = 1e4+10;
typedef pair<int,int> pii;
#define fr(i,a,b) for(int i = a;i <= b; ++i)
#define nfr(i,a,b) for(int i = a;i >= b; --i)
#define pb push_back

vector<int> edge[N],id[N];
int c[N],ans[M];
pii p[M];
int n,m;
int dfn[N],tot;

inline void tarjan(int x,int fa){
   dfn[x] = ++tot;
   fr(i,0,(int)edge[x].size()-1){
      int y = edge[x][i];
      if(y == fa)continue ;
      if(!dfn[y])ans[abs(id[x][i])] = id[x][i] > 0 ? 1 : -1,tarjan(y,x);
      else ans[abs(id[x][i])] = id[x][i] > 0 ? -1 : 1;
   }
}

int main(){
   scanf("%d%d",&n,&m);
   fr(i,1,m){
      int x,y; scanf("%d%d",&x,&y);
      p[i] = pii(x,y);
   }
   fr(i,1,n)scanf("%d",c+i);

   fr(i,1,m){
      if(c[p[i].first] == c[p[i].second]){
         edge[p[i].first].pb(p[i].second); id[p[i].first].pb(i);
         edge[p[i].second].pb(p[i].first); id[p[i].second].pb(-i);
      } else {
         ans[i] = (c[p[i].first] < c[p[i].second]) ? -1 : 1;
      }
   }
   fr(i,1,n)if(!dfn[i])tarjan(i,0);
   fr(i,1,m){
      if(ans[i] == 1)puts("->");
      else puts("<-");
   }
   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';
        }
    }



}
