#include <bits/stdc++.h> #include<math.h> using namespace std; const int MAX_LEN = 100005; //const int MAX_D = 31; struct ID{ char tem[20]; }; int main(){ int n; cin>>n; ID temp[n]; int flag[n]; for(int i =0;i<n;++i){ flag[i] = 1; } for(int i =0;i<n;++i){ cin>>temp[i].tem; } int result[n]; for(int i = 0;i<n;++i){ for(int j =0;j<17;++j){ if(!((temp[i].tem[j]-'0')>=0 &&(temp[i].tem[j]-'0')<=9)){ flag[i] = false; break; } } } for(int i =0;i<n;++i){ if(flag[i] == true){ result[i] = ((temp[i].tem[0]-'0')*7 + (temp[i].tem[1]-'0')*9 + (temp[i].tem[2]-'0')*10 + (temp[i].tem[3]-'0')*5 + (temp [i] .te I [4 ] - ' 0 ' ) * 8 + (temp [i] .te I [ 5 ] - ' 0 ' ) * 4 + (temp [i] .te I [ 6 ] - ' 0 ' ) * 2 + (temp [i] .te I [ 7 ] - ' 0 ' ) * 1 + (temp [i] .te I [ 8 ] - ' 0 ' ) * 6 + (temp [i] .te I [ 9 ] - ' 0 ' ) * 3 + (temp [i] .te I [ 10 ] - '0 ' ) *7 + (temp [i] .te I [ 11 ] - ' 0 ' ) * 9 + (temp [i] .te I [ 12 ] - ' 0 ' ) * 10 + (temp [i] .te I [ 13 ] - ' 0 ' ) * 5 + (temp [i] .te I [ 14 ] - ' 0 ' ) * 8 + (temp [i] .te I [ 15 ] - ' 0 ' ) * 4 + (temp [i] .te I [ 16 ] - ' 0 ' ) * 2 )% 11 ; } } int s[11] = {1,0,10,9,8,7,6,5,4,3,2}; for(int i=0;i<n;++i){ int fas = result[i]; int sdf = s[fas]; if(sdf == 10){ result[i] = 10; }else{ result[i] = sdf; } } for(int i=0;i<n;++i){ char c; if(result[i] != 10){ c = ('0' +(result[i]-0)); } else{ c = 'X'; } if(c != temp[i].tem[17]){ flag[i] = false; } } int count = 0; for(int i = 0;i<n;++i){ if(flag[i]==true){ count++; }else{ for(int j=0;j<18;++j){ if(j!=17){ cout<<temp[i].tem[j]; }else{ cout<<temp[i].tem[j]<<endl; } } } } if(count == n){ cout<<"All passed"<<endl; } system("pause"); return 0; }