pots
#include<iostream>
#include<vector>
using namespace std;
struct SET{
//set表示操作 1.FILL(a) 2.FILL(b) 3.DROP(a) 4.DROP(b) 5.POUR(a,b) 6.POUR(b,a)
int a,b,father,set;
}op[10000010],opnow;
bool repeat[110][110];
int main()
{
int a,b,c,f=0,l=1;
scanf("%d%d%d",&a,&b,&c);
op[0].a=0,op[0].b=0,op[0].father=-1,op[0].set=0;
repeat[0][0]=1;
while(f<l)
{
for(int i=1;i<=6;i++)
{
opnow=op[f];
opnow.set=i,opnow.father=f;
switch(opnow.set)
{
case 1:
opnow.a=a;
break;
case 2:
opnow.b=b;
break;
case 3:
opnow.a=0;
break;
case 4:
opnow.b=0;
break;
case 5:
if(opnow.a+opnow.b>=b)
{
opnow.a-=(b-opnow.b);
opnow.b=b;
}
else
{
opnow.b+=opnow.a;
opnow.a=0;
}
break;
case 6:
if(opnow.a+opnow.b>=a)
{
opnow.b-=(a-opnow.a);
opnow.a=a;
}
else
{
opnow.a+=opnow.b;
opnow.b=0;
}
}
if(repeat[opnow.a][opnow.b]==1)
{
continue;
}
repeat[opnow.a][opnow.b]=1;
op[l++]=opnow;
if(opnow.a==c||opnow.b==c)
{
vector<int> ans;
l--;
while(1)
{
ans.push_back(op[l].set);
l=op[l].father;
if(l==-1)
break;
}
int size=ans.size()-1;
printf("%d\n",size);
for(int i=size-1;i>=0;i--)
{
switch(ans[i])
{
case 1:printf("FILL(1)\n"); break;
case 2:printf("FILL(2)\n"); break;
case 3:printf("DROP(1)\n"); break;
case 4:printf("DROP(2)\n"); break;
case 5:printf("POUR(1,2)\n"); break;
case 6:printf("POUR(2,1)\n"); break;
}
}
return 0;
}
}
f++;
}
printf("impossible\n");
return 0;
}