#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
string tostr(ll n)
{ stringstream rr;rr<<n;return rr. str();}
ll toint(string s) 
{stringstream ss(s);ll x;ss>>x;return x;}
void solve()
{
  ll n, a,m=0,b=0, c=0,k=0, i, j,l=998244353;
  char s, r, y;
  
  ll hit=0, yog;
  cin>>s>>r>>y;
  if(s==r && s==y) cout<<"Won";
  else cout<<"Lost";
}
int main()
{
  
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
   //cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}
#include "bits/stdc++.h"
using namespace std; 
#define for_(i, s, e) for (int i = s; i < (int) e; i++)
#define for__(i, s, e) for (ll i = s; i < e; i++)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define endl '\n'

// if two adjacent nodes have same reachability, then they are in SCC
// now we have a DAG to solve with
// if two adjacent nodes have different reachability, then their direction is easily found
// reduced to making graph SCC by directing edges
// read CF blog post for details on how to do that (is-this-fft)

int n, m;
vector<vector<ii>> adj;
vector<ii> ans;
vi vis;

int dfs(int p, int parent) {
	if (vis[p]) return 1;
	vis[p] = 1;
	
	for (auto i: adj[p]) if (i.first != parent and ans[i.second].first == -1) {
		int v = dfs(i.first, p);
		// cout << "going edge " << p << " - " << i.first << " ... " << v << endl;
		ans[i.second] = {i.first, p};
		// if (v) ans[i.second] = {p, i.first};
	}
	
	vis[p] = 2;
	return 0;
}

int main() {
	#ifdef mlocal
	freopen("test.in", "r", stdin);
	#endif
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> n >> m;
	vector<ii> edges(m);
	adj.resize(n); ans.resize(m, {-1, -1}); vis.resize(n);
	
	for_(i, 0, m) {
		int a, b; cin >> a >> b;
		a -= 1; b -= 1;
		adj[a].push_back({b, i}); adj[b].push_back({a, i});
		edges[i] = {a, b};
	}
	
	vi reach(n);
	for_(i, 0, n) cin >> reach[i];
	for_(i, 0, m) if (reach[edges[i].first] != reach[edges[i].second]) {
		ans[i] = {edges[i].first, edges[i].second};
		if (reach[edges[i].first] < reach[edges[i].second]) ans[i] = {edges[i].second, edges[i].first};
	}
	
	for_(i, 0, n) if (!vis[i]) dfs(i, i);
	
	for_(i, 0, m) {
		if (edges[i] == ans[i]) cout << "->";
		else cout << "<-";
		cout << endl;
	}
	
	

	return 0;
}