#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  int l = v.size();
  for (int i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << endl;
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
const long double PI = 3.1415926535897932384626433832795;
const int N = 42;
int n, m;
char s[N][N];
int dp[N][N][N][N][2], vis[N][N][N][N][2];
int solve(int x_1, int x_2, int y_1, int y_2, int p) {
  if (vis[x_1][x_2][y_1][y_2][p]) return dp[x_1][x_2][y_1][y_2][p];
  vis[x_1][x_2][y_1][y_2][p] = 1;
  set<int> h;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int x = i + j, y = n - i + 1 + j;
      if ((x & 1) != p) continue;
      if (!(x_1 <= x && x <= x_2 && y_1 <= y && y <= y_2)) continue;
      if (s[i][j] == 'L')
        h.insert(solve(x_1, x - 1, y_1, y_2, p) ^
                 solve(x + 1, x_2, y_1, y_2, p));
      else if (s[i][j] == 'R')
        h.insert(solve(x_1, x_2, y_1, y - 1, p) ^
                 solve(x_1, x_2, y + 1, y_2, p));
      else
        h.insert(solve(x_1, x - 1, y_1, y - 1, p) ^
                 solve(x_1, x - 1, y + 1, y_2, p) ^
                 solve(x + 1, x_2, y_1, y - 1, p) ^
                 solve(x + 1, x_2, y + 1, y_2, p));
    }
  }
  int tmp = 0;
  for (; h.count(tmp); tmp++)
    ;
  return dp[x_1][x_2][y_1][y_2][p] = tmp;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> (s[i] + 1);
  if (solve(2, n + m, 2, n + m, 0) ^ solve(2, n + m, 2, n + m, 1))
    cout << "WIN\n";
  else
    cout << "LOSE\n";
  return 0;
}
