int i,j,k;char s[9];p(int n){if(n<2)return 0;else if(n==2)return 1;if(n%2==0)return 0;for(i=3;i*i<=n;i+=2)if(n%i==0)return 0;return 1;}main(){while(scanf("%d",&j)){if(!j)break;while(k++<j){if(p(k-1)&&p(k-3)){sprintf(s,"%d %d",k-3,k-1);}}puts(s);}}