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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	for(int i; scanf("%d", &i); printf("3C%02d\n", i)) i = (i - 1) % 39 + 1;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <complex>
using namespace std;

typedef long long ll;

#define REP(i,a,b) for(int i=a; i<b; i++)
#define rep(i,n) REP(i,0,n)

int main(){
  int n;

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

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

using namespace std;

int main() {
  
  int n;
  while(cin >> n) {
    if(n%39 == 0) cout << "3C39" << endl;
    else printf("3C%02d\n", n%39);
  }
  return 0;
}

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>
using namespace std;

int main() {
	int s[20];
	int a;
	for (int i = 0; i < 20; i++){
		cin >> a;
		s[i] = a % 39;
	}
	for (int i = 0; i < 20; i++){
		if (s[i] == 0) {
			cout << "3C39";
		}
		else cout << "3C" << s[i];
		cout << endl;
	}
}

C++: #include <cstdio>

int main(){
  int N;
  while(~scanf("%d" ,&N)){
    printf("3C%02d\n" ,N % 39 ? N % 39 : 39);
  }
  return 0;
}

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

int main()
{
  while(true)
  {
    int candy;
    cin >> candy;
    if ( cin.eof() ) break;
    cout << "3C" << candy&39 << endl;
  }
}

C++: 
#include <iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int a,b;
    while(cin>>a){
        b=a%39;
        if(b==0){
            printf("3C39");
            cout<<endl;
        }else{
            printf("3C%02d",b);
            cout<<endl;
        }
    }
    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 <bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
using namespace std;
int main(){
	int a;
	while(cin>>a){
		while(a>39)a-=39;
		cout<<3<<'c';
		if(a<10)cout<<0;
		cout<<a<<endl;
	}return 0;
}

C++: main(n){
    for(;~scanf("%d",&n);printf(n<10?"3C0%d\n":"3C%d\n",n))
        n=(n-1)%39+1;
}

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



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

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

int n;

int main()
{
    while(cin >> n) 
        if(n % 39)
            cout << "3C" << setw(2) << setfill('0') << (n % 39) << endl;
        else 
            cout << "3C39" << endl;
    
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

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

C++: #include<iostream>
#define n 39
using namespace std;

int main(){
	
	int c;
	while(cin>>c){
		int s=c%n;
	if(s==0)
		cout<<"3C39"<<endl;
	else if(s<=9)
		cout<<"3C0"<<s<<endl;
	else if(s<=38)
		cout<<"3C"<<s<<endl;
	
		}
	
	
}

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

using namespace std;

int main(){
  for(int n;cin>>n;){
    cout<<"3C"<<setw(2)<<setfill('0')<<right<<(n-1)%39+1<<endl;
  }
  return 0;
}

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

int main(){
    int p;
    while(cin >> p){
        p %= 39;

        if(p == 0)  p = 39;

        printf("3C%02d\n", p);
    }

    return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
	int a;
	while(true){
		cin >> a;
		if(!a)
			return 0;
		a = a%39;
		if(a<10)
			cout << "3C0" << a << endl;
		else
			cout << "3C0" << a << endl;
	}
}

C++: #include <stdio.h>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){

	int num;

	while(scanf("%d",&num)!=EOF){
		printf("3C%02d\n",(num-1)%39+1);
	}

    return 0;
}

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

int main(void){
	int n;
	
	while(cin>>n){
		while(true){
			
			if(1<=n && n<=HITO){
				int i;
				for(i=0;n>0;i++){
					n--;
				}
				printf("3C%02d\n",i);
				break;
			}			
			else if(n>HITO){
				
				n=n%HITO;
			
				if(n!=0){
					printf("3C%02d\n",n);
					break;
				}
				else if(n==0){
					cout<<"3C39"<<endl;
					break;
				}
			}
		}
	}
	return 0;
}

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

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