#include<bits/stdc++.h> using namespace std; int main(){ int t,i,x,d2,m2,y2,d1,m1,y1; cin>>t; for(i=1; i<=t; i++){ scanf("%d/%d/%d",&d2,&m2,&y2); scanf("%d/%d/%d",&d1,&m1,&y1); cout<<"Case #"<<i<<": "; x=(y2-y1)-(m2<m1)-(m2==m1 && d2<d1); if(x<0) cout<<"Invalid birth date"<<endl; else if(x>130) cout<<"Check birth date"<<endl; else cout<<x<<endl; } }