#include <iostream>
using namespace std;
int card[6];
void sort(void)
{
int i, j = 0, temp1, temp2;
for(i = 1; i < 6; i++) {
if(card[i-1] > card[i]) {
temp1 = card[i];
j = 0;
while(card[j] < card[i]) j++;
for(; j <= i; j++) {
temp2 = card[j];
card[j] = temp1;
temp1 = temp2;
}
}
}
return ;
}
int check(void)
{
int i, j, k, temp[6];
for(i = 0; i < 6; i++) {
temp[i] = card[i];
}
for(i = 0; i < 4; i++) {
for(j = i+1; j < 5; j++) {
for(k = j+1; k < 6; k++) {
if((temp[i] == temp[j] && temp[j] == temp[k]) || (temp[i]+1 == temp[j] && temp[j]+1 == temp[k])) {
temp[i] = -1;
temp[j] = -1;
temp[k] = -1;
for(int x = 0; x < 4; x++) {
if(temp[x] >= 0) {
for(int y = x+1; y < 5; y++) {
if(temp[y] >= 0) {
for(int z = y+1; z < 6; z++) {
if(temp[z] >= 0) {
if((temp[x] == temp[y] && temp[y] == temp[z]) ||
(temp[x]+1 == temp[y] && temp[y]+1 == temp[z])) {
return 1;
}
}
}
}
}
}
}
}
for(int m = 0; m < 6; m++) {
temp[m] = card[m];
}
}
}
}
return -1;
}
int main(void)
{
int i;
for(i = 0; i < 6; i++) {
cin >> card[i];
}
sort();
if(check() == 1) {
cout << "gin" << endl;
return 0;
}
cout << "lose" << endl;
return 0;
} |