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<stdio.h>
 
int main(){
	int a;
	while(scanf("%d", &a) != EOF){
		if(a % 39 == 0) printf("3C%d\n", 39);
		else printf("3C%d\n", a % 39);
	}
	return 0;
}

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

int main(){
	int input, ans;
	while(cin >> input){
		ans = input % 39;
		cout << "3C";
		if(ans == 0) cout << "39" << endl;
		else if(0 < ans && ans <= 9) cout << "0" << ans << endl;
		else cout << ans << endl;
	}
}

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

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

C++: #include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>
#include <iterator>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef vector<double> vd;
typedef vector<vd> vvd;

int main()
{
	int n;
	while(scanf("%d", &n) != EOF){
		printf("3C%02d\n", (n+38)%39+1);
	}
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

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

C++: #include <iostream>
#include <stdio.h>
using namespace std;
int main(){
	int n;
	while(scanf("%d",&n) != EOF){
		cout<<"3C";
		if(n%39==0) cout<<"39"<<endl;
		else if(n%39<10 && n%39>0) cout<<"0"<<n%39<<endl;
		else cout<<n%39<<endl;
	}
	return 0;
}

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

C++: #include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

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

int main(){
    int N;
    while (cin >> N&& N){
        N--;
        int ans = N % 39 + 1;
        cout << "3C" << (ans < 10 ? "0" : "") << ans << endl;
    }
}

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

int main() {
	int a;
	while (cin >> a) {
		int b = (a % 39);
		if (b == 0) { b = 39; }
		cout << "3C";
		if (1 <= b&&b <= 9) { cout << "0"; }
		cout << b << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  int n;
  while(cin>>n)
    cout<<(n-1)%39+1<<endl;
  return 0;
}

C++: #include<iostream>
int main(){
 while(!std::cin.eof()){
 int in;  
 std::cin >> in;
 in%=39;
 if(!in) in = 39;
 std::printf("3C%02d\n",in);
 }
}

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

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (int a; scan(a);)
		printf("3C%02d\n", (a %= 39) ? a : 39);
}

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

#define int long long

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

C++: #include<iostream>
int main(){
 while(!std::cin.eof()){
 int in;  
 std::cin >> in;
 if(!in=in%39) in =39;
 std::printf("3C%02d\n",in);
 }
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>



using namespace std;

typedef pair<double, int> P;

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

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;
	}
}

C++: #include<iostream>
using namespace std;
#define EOF -1

int main(){
	int n,count;
	while(1){
		cin>>n;
		if(n==EOF)break;
		count=n%39;
		if(count==0)count=39;
		cout<<"3C"<<count<<endl;
	}
	return 0;
}

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<cstdio>
using namespace std;
int main(){
  int bell,number;
  while(scanf("%d",&bell)!=EOF){
    number=0;
    while(bell!=0){
      if(bell>39){
	bell-=39;
      }
      else{
	bell--;
	number++;
      }
    }
    if(number<10){
      cout << "3C0" << number << endl;
    }
    else{
      cout << "3C" << number << endl;
    }
  }
}