#include <iostream>
using namespace std;
int game(int a,int b){
if(a==0||b==0)
return 0;
if(a<b){
a^=b;
b^=a;
a^=b;
}
int ans=!game(b,a%b);
if(!ans&&a/b>1)
ans=!game(b+a%b,b);
return ans;
}
int main(){
int a,b;
while(cin>>a>>b&&a){
if(game(a,b))
cout<<"Stan wins";
else
cout<<"Ollie wins";
cout<<endl;
}
}
using namespace std;
int game(int a,int b){
if(a==0||b==0)
return 0;
if(a<b){
a^=b;
b^=a;
a^=b;
}
int ans=!game(b,a%b);
if(!ans&&a/b>1)
ans=!game(b+a%b,b);
return ans;
}
int main(){
int a,b;
while(cin>>a>>b&&a){
if(game(a,b))
cout<<"Stan wins";
else
cout<<"Ollie wins";
cout<<endl;
}
}
Comments
Post a Comment