#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define out(a) copy(a.begin(),a.end(),ostream_iterator<int>(cout," "))
bool vist[ 501 ] [ 501 ] [ 501 ] ;
class BearPlaysDiv2 {
public :
string equalPiles( int A, int B, int C) {
queue< int > que;
int arr[ ] = { A, B, C } , tmp[ 3 ] ;
sort( arr, arr + 3 ) ;
for ( int i = 0 ; i < 3 ; ++ i)
que.push ( arr[ i] ) ;
vist[ arr[ 0 ] ] [ arr[ 1 ] ] [ arr[ 2 ] ] = 1 ;
while ( que.size ( ) ) {
for ( int i = 0 ; i < 3 ; ++ i) {
arr[ i] = que.front ( ) ;
que.pop ( ) ;
}
if ( arr[ 0 ] == arr[ 1 ] && arr[ 0 ] == arr[ 2 ] )
return "possible" ;
for ( int i = 1 ; i < 3 ; ++ i) {
memcpy ( tmp, arr, sizeof tmp) ;
tmp[ i] - = tmp[ i - 1 ] ;
tmp[ i - 1 ] * = 2 ;
sort( tmp, tmp + 3 ) ;
if ( vist[ tmp[ 0 ] ] [ tmp[ 1 ] ] [ tmp[ 2 ] ] )
continue ;
vist[ tmp[ 0 ] ] [ tmp[ 1 ] ] [ tmp[ 2 ] ] = 1 ;
for ( int i = 0 ; i < 3 ; ++ i)
que.push ( tmp[ i] ) ;
}
memcpy ( tmp, arr, sizeof tmp) ;
tmp[ 2 ] - = tmp[ 0 ] ;
tmp[ 0 ] * = 2 ;
sort( tmp, tmp + 3 ) ;
if ( vist[ tmp[ 0 ] ] [ tmp[ 1 ] ] [ tmp[ 2 ] ] )
continue ;
vist[ tmp[ 0 ] ] [ tmp[ 1 ] ] [ tmp[ 2 ] ] = 1 ;
for ( int i = 0 ; i < 3 ; ++ i)
que.push ( tmp[ i] ) ;
}
return "impossible" ;
}
} ;
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBvdXQoYSkgY29weShhLmJlZ2luKCksYS5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