#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         cout<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define endl            "\n"
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


void __print(int32_t x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
char myHeap[200 * 1024 * 1024];
int sz = 0;
void assert_tle(bool q) { while (!q); }
void* operator new  ( std::size_t count ) {
    sz += count;
    assert_tle(sz <= 200 * 1024 * 1024);
    return myHeap + sz - count;
}
 
void operator delete (void *ptr) { }
 
 
void fastIO()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

void dfs(vector<int> graph[],int cur,int used[],map<int,int> mp[])
{
    if(used[cur]) return;

    used[cur]=1;

    for(int kid: graph[cur])
    {
        if(mp[kid][cur]) continue;

        if(used[kid])
        {
            mp[cur][kid]=1;
            mp[kid][cur]=-1;
        }
        else
        {
            mp[cur][kid]=1;
            mp[kid][cur]=-1;
            dfs(graph,kid,used,mp);
        }
    }
}

void solve()
{
    int n,m;
    cin>>n>>m;
    pii edge[m];
    vector<int> graph[n];

    map<int,int> mp[n];
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        x--;y--;

        graph[x].pb(y);
        graph[y].pb(x);
        edge[i]={x,y};
    }
    pii vals[n];

    for(int i=0;i<n;i++)
    {
        cin>>vals[i].ff;
        vals[i].ss=i;
    }

    for(int i=0;i<n;i++)
    {
        for(int kid: graph[i])
        {
            if(vals[i].ff>vals[kid].ff)
            {
                mp[i][kid]=1;
                mp[kid][i]=-1;
            }
            else if(vals[kid].ff>vals[i].ff)
            {
                mp[i][kid]=-1;
                mp[kid][i]=1;
            }
        }
    }

    sort(vals,vals+n);
    int used[n]={0};

    for(pii i: vals)
    {
        dfs(graph,i.ss,used,mp);
    }



    for(pii i: edge)
    {
        if(mp[i.ff][i.ss]==1)
        {
            cout<<"->"<<endl;
        }
        else
        {
            cout<<"<-"<<endl;
        }
    }

}
 
int32_t main()
{
    fastIO();
   // w(t)
    {
        solve();
        cout<<endl;
    }
    return 0;
}
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second

typedef long long lli;
typedef pair<int, int> pii;

const int maxn = 1e4 + 5;

int n, m;
pii edges[maxn];
vector<int> gr[maxn];
int c[maxn];

string ans[maxn];

bool vis[maxn];
int depth[maxn];

void read_input()
{
    cin >> n >> m;
    for(int i = 1; i <= m; ++i)
    {
        int u, v;
        cin >> u >> v;
        edges[i] = pii(u, v);
        gr[u].push_back(i);
        gr[v].push_back(i);
    }
    for(int i = 1; i <= n; ++i)
        cin >> c[i];
}

void get_ans(int id, int u, int v)
{
    ans[id] = (edges[id].fi == u ? "->" : "<-");
}

void dfs(int u)
{
    vis[u] = true;
    for(auto&id: gr[u])
    {
        if(ans[id] != "?") continue;
        int v = edges[id].fi + edges[id].se - u;
        if(!vis[v])
        {
            get_ans(id, u, v);
            depth[v] = depth[u] + 1;
            dfs(v);
        }
    }
}

void solve()
{
    fill(ans + 1, ans + m + 1, "?");
    for(int i = 1; i <= m; ++i)
    {
        int u = edges[i].fi, v = edges[i].se;
        if(c[u] > c[v])
            get_ans(i, u, v);
        else if(c[u] < c[v])
            get_ans(i, v, u);
    }
    for(int i = 1; i <= n; ++i)
        if(!vis[i])
        {
            depth[i] = 1;
            dfs(i);
        }
    for(int i = 1; i <= m; ++i)
    {
        if(ans[i] != "?") continue;
        int u = edges[i].fi, v = edges[i].se;
        if(depth[u] > depth[v])
            get_ans(i, u, v);
        else get_ans(i, v, u);
    }
    for(int i = 1; i <= m; ++i)
        cout << ans[i] << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}

