#include<bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
	char ch=getchar(); int ne=0; while(!isdigit(ch)) {if(ch=='-') ne=1; ch=getchar();}
	int ans=0; while(isdigit(ch)) ans=ans*10+ch-'0',ch=getchar();
	if(ne) return -ans;
	else return ans;
}
#define mod 998244353
inline int add(int x,int y) {return x+y>=mod?x+y-mod:x+y;}
inline int sub(int x,int y) {return x-y<0?x-y+mod:x-y;}
inline int mul(int x,int y) {return 1LL*x*y%mod;}
inline int add(int x,int y,int z) {return add(add(x,y),z);}
inline int mul(int x,int y,int z) {return mul(mul(x,y),z);}
int qpow(int x,ll y)
{
	int ans=1;
	while(y)
	{
		if(y&1) ans=mul(ans,x);
		x=mul(x,x),y>>=1;
	}
	return ans;
}
int Inv(int x) {return qpow(x,mod-2);}
signed main()
{
	int cnt=0;
	while(1)
	{	
		system("./gen > dfs.in");
		system("./dfs");
		system("./bf");
		if(system("diff -b dfs.ans dfs.out")) cout<<"wa\n",exit(0);
		printf("ac %d\n",++cnt);
	}
	return 0;
}

