#include<bits/stdc++.h>
#define MAXN 100005
using namespace std;
char s[MAXN];
int ch[MAXN][5],vis[MAXN],tot = 0,flag = 0,cas;
void trie() {
int u = 0,len = strlen(s);
for(int i = 0;i < len;i ++) {
int c = s[i] - '0';
if(!ch[u][c]) ch[u][c] = ++ tot;
if(vis[u] == 1) flag = 1;
u = ch[u][c];
}
vis[u] = 1;
}
int main()
{
cas = 1;
while(~scanf("%s",s)) {
if(s[0] == '9' && strlen(s) == 1) {
if(flag) printf("Set %d is not immediately decodable\n",cas);
else printf("Set %d is immediately decodable\n",cas);
flag = tot = 0; cas ++;
memset(ch,0,sizeof ch);
memset(vis,0,sizeof vis);
continue;
}
trie();
}
return 0;
}