G++AC
#include <iostream>
#include <cstring>
#include <queue>
using namespace std;
int A,B,C,vis[150][150],flag=0;//flag用于判断是否有结果
char *w=NULL;
struct point
{
int a,b;//a中的水和b中的水
char c[10000];//存入路径
};
void pour(int *a,int *b,int AN,int BN) //把*b中的水倒入*a中
{
int AS=AN-(*a);
if((*b)>AS)
{
int c=(*b)-AS;
(*a)=AN;
(*b)=c;
}
else
{
(*a)+=(*b);
(*b)=0;
}
return ;
}
void bfs(int x,int y)
{
point first;
first.a=0,first.b=0;
queue<point>q;
q.push(first);
vis[first.a][first.b]=0;
while(!q.empty())
{
point deal;
deal=q.front(),q.pop();
// cout<<deal.a<<" "<<deal.b<<endl;
w=deal.c;
if(deal.a==C || deal.b==C)
{flag=1; return ;}
for (int i = 0; i < 6; ++i)
{
point now;
now=deal;
// cout<<"now : "<<now.a<<" "<<now.b<<endl;
if(i==0)
{
now.a=A;
if(vis[now.a][now.b])
{
vis[now.a][now.b]=0;
strcat(now.c,"FILL(1)");
q.push(now);
}
}
now=deal;
if(i==1)
{
now.b=B;
if(vis[now.a][now.b])
{
vis[now.a][now.b]=0;
strcat(now.c,"FILL(2)");
q.push(now);
}
}
now=deal;
if(i==2)
{
pour(&now.a,&now.b,A,B);
if(vis[now.a][now.b])
{
vis[now.a][now.b]=0;
strcat(now.c,"POUR(2,1)");
q.push(now);
}
}
now=deal;
if(i==3)
{
pour(&now.b,&now.a,B,A);
if(vis[now.a][now.b])
{
vis[now.a][now.b]=0;
strcat(now.c,"POUR(1,2)");
q.push(now);
}
}
now=deal;
if(i==4)
{
now.a=0;
if(vis[now.a][now.b])
{
vis[now.a][now.b]=0;
strcat(now.c,"DROP(1)");
q.push(now);
}
}
now=deal;
if(i==5)
{
now.b=0;
if(vis[now.a][now.b])
{
vis[now.a][now.b]=0;
strcat(now.c,"DROP(2)");
q.push(now);
}
}
}
}
}
int main(void)
{
while (cin >> A>>B>>C)
{
flag=0;
memset(vis,1,sizeof(vis));
bfs(A,B);
if(flag==1)
{
int m=strlen(w),l=1;
for (int i = 0; i < m-1; ++i)
if(w[i]==')')l++;
cout<<l<<endl;
for (int i = 0; i < m; ++i)
{
cout<<w[i];
if(w[i]==')')cout<<endl;
}
}
else cout<<"impossible"<<endl;
}
return 0;
}