// Decide existence of a nonzero, strict literal-F key for periods 7 and 8 by including all starting phases. A positive is just an example.
#include <algorithm>
#include <array>
#include <cstdint>
#include <iostream>
#include <vector>
using namespace std;
template<int P> struct Search {
 struct R{int n=0;unsigned char bad[P][29]{};};
 static constexpr int A=(1<<P)-1;
 vector<R>B;vector<int> order;int key[P],d,init,answer[P];unsigned char rot[P][1<<P];uint64_t calls=0,pruned=0;bool stopped=false;static constexpr uint64_t cap=12000000;
 Search(vector<int> const&x){B.emplace_back();for(int c:x){if(!c){B.emplace_back();continue;}auto &b=B.back();int t=b.n++%P;for(int s=0;s<P;s++)b.bad[s][c]|=1<<((s-t+P)%P);}
 for(int n=0;n<P;n++)for(int m=0;m<=A;m++)rot[n][m]=((m<<n)|(m>>(P-n)))&A;
 // Ascending slot order; slot 0 is a smallest positive shift. Initial phase free.
 for(int i=0;i<P;i++)order.push_back(i);}
 bool dfs(int j,vector<unsigned char> const&mask,int eligible){
  if(calls>=cap){stopped=true;return false;}
  int slot=order[j];
  for(int z=0;z<29;z++){
   if((j==0&&z!=d)||(j>0&&z!=0&&z<d))continue;
   key[slot]=z;int adv=z?eligible:(eligible & ~(1<<slot));++calls;
   vector<unsigned char> m(mask.size());int h=A;
   for(size_t i=0;i<B.size();i++){const auto &b=B[i];m[i]=mask[i]&~b.bad[slot][z];h=rot[b.n%P][h&m[i]];
    if(!h)break;if(i+1<B.size())h|=rot[1%P][h&adv];}
   if(!h){++pruned;continue;}
   if(j+1==P){for(int q=0;q<P;q++)answer[q]=key[q];return true;}
   if(dfs(j+1,m,adv))return true;if(stopped)return false;
  }return false;
 }
 void run(){vector<unsigned char> full(B.size(),A);bool found=false;
  for(d=1;d<29&&!stopped;d++)if(dfs(0,full,A)){found=true;break;}
  cout<<P<<' '<<(found?"witness":stopped?"incomplete":"excluded")<<' '<<calls<<' '<<pruned;if(found)for(int a:answer)cout<<' '<<a;cout<<endl;}
};
int main(){vector<int>x;int c;while(cin>>c){if(c<0||c>28)return 3;x.push_back(c);}Search<7>(x).run();Search<8>(x).run();}
