#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
#define mem(x,i) memset(x,i,sizeof(x))
#define sf1(a) scanf("%d", &a)
#define sf2(a,b) scanf("%d %d", &a, &b)
#define sf3(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define sf scanf
#define pf printf
const double EPS = 1e-10;
const double pai = acos(-1.0);
const int INF = 0xfffffff;
const int MOD = 1000000007;
typedef long long LL;
const int maxn = 205;
int g[maxn];
char a[maxn];
int mex(set<int> &s){
set<int>::iterator it = s.begin();
for (int i = 0; it != s.end(); it++, i++)
if (*it != i)
return i;
return s.size();
}
void GetSG(){
g[0] = 0; g[1] = g[2] = g[3] = 1;
for (int x = 4; x < maxn; x++){
set<int> s;
for (int j = 3; x - j >= 0; j++){
if (j <= 5)
s.insert(g[x - j]);
else if (j > 5)
s.insert(g[j - 5] ^ g[x - j]);
}
g[x] = mex(s);
}
}
bool judge(char *a){
int len = strlen(a);
for (int i = 0; i < len; i++){
if (i + 2 < len&&a[i] == 'X'&&a[i + 1] == 'X'&&a[i + 2] == 'X')
return false;
}
for (int i = 0; i < len; i++){
if ((i + 1 < len&&a[i] == 'X'&&a[i + 1] == 'X') || (i + 2 < len&&a[i] == 'X'&&a[i + 2] == 'X'))
return true;
}
char b[maxn];
strcpy(b, a);
for (int i = 0; i < len; i++){
if (a[i] == 'X'){
if (0 <= i - 1 && i - 1 < len) b[i - 1] = 'X';
if (0 <= i - 2 && i - 2 < len) b[i - 2] = 'X';
if (0 <= i + 1 && i + 1 < len) b[i + 1] = 'X';
if (0 <= i + 2 && i + 2 < len) b[i + 2] = 'X';
}
}
int cnt = 0;
vector<int> s;
for (int i = 0; i < len; i++){
if (b[i] == 'X'){
s.push_back(cnt);
cnt = 0;
}
else if (b[i] == '.')
cnt++;
if (i == len - 1) s.push_back(cnt);
}
int ret = 0;
for (int i = 0; i < s.size(); i++)
ret ^= g[s[i]];
return ret != 0;
}
int main()
{
//freopen("f:\\input1.txt", "r", stdin);
GetSG();
int T;
sf1(T);
while (T--){
sf("%s", a);
if (judge(a)){
pf("WINNING\n");
vector<int> ans;
for (int i = 0; i < strlen(a); i++){
if (a[i] == '.'){
a[i] = 'X';
if (judge(a) == false) ans.push_back(i + 1);
a[i] = '.';
}
}
for (int i = 0; i < ans.size(); i++)
pf("%d%s", ans[i], i == ans.size() - 1 ? "\n" : " ");
}
else pf("LOSING\n\n");
}
return 0;
}
/*
4
.....
X.....X..X.............X....X..X
.X.X...X
...............................................
WINNING
3
LOSING
WINNING
3
WINNING
1 12 15 17 20 24 28 31 33 36 47
*/