#include <iostream.h>
#include <stdlib.h>
#include <time.h>
#include <iomanip>

int a;
int last;
int re;
short x;
short y;
int z;
short first[11];
short sec[11];



int main()
{
 using namespace std;
 start:
 cout<<"\n\nEnter the last number, enter a number greater than 39 to exit. ";
 cin>>last;
 if (last > 39)
 {
  return 0;
 } 
 re = last % 4;
  
 
 for(y = re, x = 1; x < 11; x++)
 {
  first[x] = y;
  sec[x] = y + 2;
  if(sec[x] > 39)
  {
   sec[x] = sec[x] - 40;
  }
  y = y + 4;
 }
 
 system("CLS");
 z=2;
 for(y = 1; y < 11; y++)
 {
  cout<<"\n";
  for(x = 1; x < 11; x++)
  {
  

   
   if(sec[x] - 2 == last || sec[x] - 38 == last || sec[x] + 2 == last || sec[x] + 38 == last || first[y] - sec[x] == 2 || first[y] - sec[x] == -38 || first[y] - sec[x] == -34 || first[y] - sec[x] == 6)
  
   {
    cout<<setw(z)<<"XX-XX-XX  ";
   }
   
     
   else
   {
    cout << setfill('0');
    cout<<setw(z)<<first[y]<<"-"<<setw(z)<<sec[x]<<"-"<<setw(z)<<last<<"  ";
   }
  } 
 }
 goto start;
}
