#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007LL;
long long large = 2000000000000000000LL;
vector<int> dp;
vector<vector<int> > adj;
int f(int u) {
  if (dp[u] != -1) return dp[u];
  vector<int> ch;
  for (int j = 0; j < (int)adj[u].size(); j++) {
    int v = adj[u][j];
    ch.push_back(f(v));
  }
  sort(ch.begin(), ch.end());
  int re = 0;
  for (int i = 0; i < (int)ch.size(); i++) {
    if (ch[i] == re)
      re++;
    else if (ch[i] > re)
      break;
  }
  dp[u] = re;
  return dp[u];
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> h(n, 0);
  for (int i = 0; i < n; i++) scanf("%d", &h[i]);
  adj.assign(n, vector<int>());
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    adj[x].push_back(y);
  }
  dp.assign(n, -1);
  int ans = 0;
  int sz = 0;
  for (int i = 0; i < n; i++) sz = max(sz, f(i) + 1);
  vector<int> tp(sz, 0);
  for (int i = 0; i < n; i++) tp[f(i)] ^= h[i];
  for (int i = 0; i < sz; i++) ans |= tp[i];
  if (ans == 0) {
    cout << "LOSE" << endl;
    return 0;
  }
  int p = -1;
  for (int i = 0; i < sz; i++) {
    if (tp[i]) p = i;
  }
  for (int i = 0; i < n; i++)
    if (f(i) == p && (h[i] ^ tp[p]) < h[i]) {
      h[i] ^= tp[p];
      tp[p] = 0;
      for (int j = 0; j < (int)adj[i].size(); j++) {
        int v = adj[i][j];
        h[v] ^= tp[f(v)];
        tp[f(v)] = 0;
      }
      break;
    }
  cout << "WIN" << endl;
  for (int i = 0; i < n; i++) cout << h[i] << " ";
  cout << endl;
  return 0;
}
