Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var scanner= bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n%39 == 0 {
			fmt.Println(fmt.Sprintf("3C%02d", 39))
			continue
		}
		fmt.Println(fmt.Sprintf("3C%02d", n%39))
	}
}

C++: 
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

int main(void){
  int n;
  int const teamname = 0;
  int const point = 1;
  while(cin>>n,n){
    vector < vector<int > > team(n+1,vector<int>(2));
    rep(i,n){
		
      int m,s;
      cin>>team[i][teamname];
      rep(h,4){
				cin>>m>>s;
				team[i][point]+=m*60+s;
			}
	
    }
    
       rep(i,n-1){
			loop(j,i,n){
	  		if(team[i][point]>team[j][point]){
	    		team[n][teamname]=team[i][teamname];
	    		team[i][teamname]=team[j][teamname];
	    		team[j][teamname]=team[n][teamname];
	    		team[n][teamname]=0;
				
	  		  team[n][point]=team[i][point];
	 		   team[i][point]=team[j][point];
	   		 team[j][point]=team[n][point];
	   		 team[n][point]=0;
				
			  }
			}
    }

    
    
/*    rep(i,n){
    	cout<<team[i][teamname]<<" "<<team[i][point]<<endl;
    }
    */
		rep(i,2){
	
	 	 cout<<team[i][teamname]<<endl;		

		}
		cout<<team[n-2][teamname]<<endl;
  }

}

C++: #include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int n;
    while( cin >> n ) {
        int const nn = n % 39;
        cout << "3C" << setw(2) << setfill('0') << ( nn == 0 ? 39 : nn ) << endl;
    }

}

C++: #include <iostream>
#include <iomanip>
using namespace std;

int main()
{	
	int n;

	while (cin >> n) {
		if (n % 39 == 0)
			n = 39;
		else
			n = n % 39;

		cout << "3C" << setw(2) << setfill('0') << n << endl;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,m;
	while(cin >> n){
		m=n%39;
		if(m==0){
			cout << "3C39" << endl;
		}else if(m<10&&m!=0){
			cout << "3C" << "0" << m << endl;
		}else{
			cout << "3C" << m << endl;
		}
	}
	return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
#define INF 114514
using namespace std;




int main(){
	int m;
	m = 39;
	int candy;
	while (cin >> candy) {
		cout <<"3C"<< candy%m << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
main(){
  int n;
  while(cin>>n){
    if(n%39==0){
      cout<<"3C39"<<endl;
    }
    else{
      printf("3C%02d\n",n%39);
    }
  }
}

C++: #include<stdio.h>
int main(void)
{
int a,b,c,x;
b=39;
scanf("%d",&a);
	if(a<b)
	{
		b=b-a;
	}
	else
	{
		x=a%b;
		if(a%b==0)
		{
			x=39;
		}
		b=0;
		b=b+x;
	}
	if(b<10)
	{
		printf("3C0%d\n",b);
	}
	else
	{
	printf("3C%d\n",b);
	}
return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;

int main(void){
    int n;
    
    while(cin >> n){
        n %= 39;
        if(!n) n += 39;
        printf("3C%02d\n" ,n);
    }
    
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
  int a;
  while (cin >> a) {
    a %= 39;
    cout << "3C" << setfill('0') << setw(2) << (a ? a : 39) << "\n";
  }
}

C++: // Tazoe

#include <iostream>
using namespace std;

int main()
{
while(true){
	int n;
	cin >> n;
if(cin.eof())
break;
	int m = n%39;

	if(m==0){
		cout << "3C39" << '\n';
	}
	else if(m>=1&&m<=9){
		cout << "3C0" << m << '\n';
	}
	else{
		cout << "3C" << m << '\n';
	}
}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int in;
while(cin>>in){
cout<<"3C"<<(in-1)%39+1<<endl;
}
}

C++: #include<stdio.h>
int main(void)
{
	int a;
	while(scanf("%d",&a)!=EOF){
		if(a%39==0) printf("3C39\n");
		else printf("3C%02d\n",a%39);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)

int main(){
    int n;
    while(cin >> n && n){
        printf("3C%02d\n", (n % 39!=0) ? n % 39 : 39);
    }
}

C++: #include<stdio.h>
int main()
{
	int a,b;
	while(scanf("%d",&a)==1){
	b=a%39;
	if(b==0){
		printf("3C39\n");
	}
	else if(b<10){
		printf("3C0%d\n",b);
	}
	else
		printf("3C%d\n",b);
	}
	return 0;
}

C++: #include <cstdio>

int main(){

	int n;

	while(scanf("%d", &n)>0){
		printf("3C%02d\n", (n-1)%39+1);
	}

	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int inf = 1000000000;

int main(void) {

  int a;
  while(cin >> a){
    a %= 39;
    if( a == 0 ) cout << "3C39" << endl;
    else cout << "3C" << (a < 10 ? "0":"") << a << endl;
  }


  return 0;
}

// EOF

C++: #include<iostream>
using namespace std;
int main(){
int in;
while(cin>>in){
cout<<"3C"<<in%39<<endl;
}
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>


typedef long long ll;
const double Eps = 1e-6;

using namespace std;

int main()
{
	int n;
	while (scanf("%d", &n) != EOF)
		printf("3C%02d\n", n % 39 ? n % 39 : 39);

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cout.fill('0');
    while(cin>>n){
        if(n%39==0)cout<<"3C39"<<endl;
        else cout<<"3C"<<setw(2)<<n%39<<endl;
    }
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){

	int n;
	cin>>n;
	n%=39;
	printf("3C%02d",n);


	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;

int main(){
	int n;
	while(cin>>n){
		cout<<"3C";
		int a=n%39;
		if(a==0)a=39;
		if(a<10)cout<<0;
		cout<<a<<endl;
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

int main()
{
    int n;
    while( scanf ( "%d\n", &n ) != EOF )
    {
        if( n % 39 == 0 && n != 0 )
        {
            printf( "3C39\n" );
        }
        else
        {
            printf( "3C%02d\n", n % 39 );

        }
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
	int n;
	while(cin >> n){
		while(n > 39){
			n -= 39;
		}
		if(n >= 10){
			printf("3C%d\n", n);
		}else{
			printf("3C0%d\n", n);
		}

	}
}

C++: #include <bits/stdc++.h>

using namespace std;


int main(void) {
	int n;

	while (cin >> n) {
		n = n % 39 == 0 ? 39 : n % 39;
		cout << "3C" << setw(2) << setfill('0') << n << endl;
	}

	return 0;
}