Go: package main

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

var scanner= bufio.NewScanner(os.Stdin)

func main() {
	MAX := 10001
	SQRT := 100
	isPrime := make([]bool, MAX)
	for i :=range isPrime {
		isPrime[i] = true
	}
	for i := 3; i < SQRT; i += 2 {
		if isPrime[i] {
			for j := i*i; j < MAX; j += i {
				isPrime[j] = false
			}
		}
	}
	// log.Println(isPrime)
	tbl := make([]int, MAX)
	ans := 0
	for i := 5; i < MAX; i += 2 {
		if isPrime[i] && isPrime[i-2] {
			ans = i
		}
		tbl[i] = ans
	}
	// log.Println(tbl)
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		if n&1 == 0 {
			n--
		}
		fmt.Printf("%d %d\n", tbl[n]-2, tbl[n])
	}
}

C++: #include <stdio.h>
const int MAX_V = 1000000; // 100????????§??´???°??¨?????????
int prime[MAX_V+1];
int main() {
	int k,i,max,min,n; // 1????´???°???0????´???°??§???????
	for(i = 2; i <= MAX_V; i++) {
		prime[i] = 1; // 2??\?????´???°??¨??????
	}
	for(i = 2; i*i <= MAX_V; i++) {
		if(prime[i]) {
			for(k = 2 * i; k <= MAX_V; k += i) {
				prime[k] = 0; // ?´???°?2?????\?????????°??´???°??§???????
			}
		}
	}
	while(scanf("%d",&n)){
		if(n == 0)break;
		max = 0; min = 0;
		for(i = 2;i <= n;i++){
			if(prime[i] && prime[i-2]){
				max = i;
				min = max -2;
				//printf("%d %d\n",i-2,i);
			}
		}
		printf("%d %d\n",min,max);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int prime_number(int n){
    int i;
    if(n<=1) return 0;
    for(i=2;i<=n/2;i++) if(n%i==0) return 0;
    return 1;
}

int main(){
    int i,j,k,n[10000],a=0;
    for(j=0;j<10000;j++){
        cin >> n[j];
        if(n[j]==0) break;
    }
    for(k=0;k<j;k++){
        for(i=n[k];i>4;i--) if(prime_number(i)) if(prime_number(i-2)){
            a=i;
            break;
        }
        if(a!=0) cout << i-2 << " " << i << endl;
    }
    return 0;
}

C++: #include <stdio.h>
int isprime(int n){//?´???°???????????¢??°
	int i;
	for(i = 2; i*i <= n; i++){
		if(n % i == 0) return 0;
	}
	return 1;
}
int main(){
	int n, i;
	while(1){//0?????\?????????????????§?????????
		scanf("%d", &n);
		if(n == 0) break;
		for(i = n; n >= 5; i--){
			if(isprime(i) == 1 && isprime(i-2) == 1){
				printf("%d %d\n", i-2, i);
				break;
			}
		}
	}
	return 0;
}

C++: #include <stdio.h>

const int MAX_V = 10000;


int main() {
	int i, k, v;
	int sousi[2];
	int prime[MAX_V + 1];
	for (i = 2; i <= MAX_V; i++) {
		prime[i] = 1;
	}
	for (i = 2; i * i <= MAX_V; i++) {
		if (prime[i]) {
			for (k = 2 * i; k <= MAX_V; k += i) {
				prime[k] = 0;
			}
		}
	}
	while (1) {
		int isprime = prime[v];
		sousi[0] = 0;
		sousi[1] = 0;
		scanf("%d", &v);
		if (v == 0) {
			break;
		}
		for (i = v; i > 2; i--) {
			if (prime[i] == 1 && prime[i - 2] == 1) {
				sousi[0] = i - 2;
				sousi[1] = i;
				break;
			}
		}
		printf("%d %d\n", sousi[0], sousi[1]);
	}	
	return 0;
}

C++: #include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;



int main(){
	int dt[10003];
	dt[0]=dt[1]=0;
	loop(i,2,10003)dt[i]=1;
	dt[10001]=dt[10002]=0;
	for(int i=2;i<100;i++){
		if(dt[i]==1){
			for(int j=2;i*j<10000;j++){
				dt[i*j]=0;
			}
		}
	}
	int n;
	while(1){
		cin>>n;
		if(n==0)break;
		int ans=0;
		rep(i,n-1){
			if(dt[i]==1 && dt[i+2]==1){
				ans=i;
			}
		}
		cout<<ans<<" "<<ans+2<<endl;
	}
	return 0;
}

C++: 
#include <stdio.h>

int p[10001];

int main(void)
{
  	unsigned i,k, n;
  	for (i = 0; i < 10000; i++){
   		p[i] = 1; 
 	}
	p[0] = 0;   
 
 	for (i = 2; i*i <= 10000; i++) {
    	if (p[i] == 1) {
     		for (k = 2*i; k <=10000 ; k += i){
        		p[k] = 0;  
  			}
		}
	}
	
	while(1){
		scanf("%d" , &n);
		if(n == 0)
			break;
		for(i = n ; i > 1;i--){
			if(p[i]*p[i -2] ==1)
				break;
		}
			if(n >= 5)
				printf("%d %d\n",i-2,i);
	}
		return 0;
}

C++: #include <stdio.h>

int isprime(int n){
    for(int i = 2; i * i <= n; i++) {
        if(n % i == 0) return 0;  //素数でない
    }
    return 1; //素数である
}

int main() {
    int n;
    int ans[2] = {};
    while(1) {
        scanf("%d", &n);
        if(n == 0) break;
        for(int i = n; i >= 5; i--) {
            if(isprime(i) == 1) {
                ans[1] = i;
                if(isprime(i - 2) == 1) {
                    ans[0] = i - 2;
                    break;
                }
            }
        }
        printf("%d %d\n", ans[0], ans[1]);
    }
}

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

bool p[101000];

void prime() {
  fill(p, p+101000, true);
  p[0] = false;
  p[1] = false;
  for(int i = 2; i < 101000; i++) {
    if(p[i]) {
      for(int j = 2; i*j < 101000; j++) {
	p[i*j] = false;
      }
    }
  }
}

int main() {
  int n;
  prime();
  while(cin >> n, n) {
    int ans;
    for(int i = 0; i < n; i++) {
      if(p[i] && p[i-2]) ans = i;
    }
    cout << ans-2 << ' ' << ans << endl;
  }
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
int main(){
  //ツ素ツ青板青カツ青ャ
  const int NUM = 10001;
  bool prime[NUM];
  prime[0] = false;
  prime[1] = false;
  for(int i=2;i<NUM;i++)
    prime[i] = true;
  for(int i=2;i*i<NUM;i++)
    for(int k=2;i*k<NUM;k++)
      prime[i*k]=false;

  int maxtwin[10001],twin;
  for(int i=5;i<10001;i++){
    if(prime[i]&&prime[i-2])twin = i;
    maxtwin[i]=twin;
  }
  for(int n;scanf("%d",&n),n;){
    cout<<maxtwin[n]-2<<" "<<maxtwin[n]<<endl;
  }
  return 0;
}

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

int main(){

	int n, prime[10001], p[10001];

	fill(prime, prime+10001, 1);
	fill(p, p+10001, 0);
	
	prime[0] = 0;
	prime[1] = 0;
	for(int i=2; i<10001; i++){
		if(prime[i] == 1){
			if(prime[i-2] == 1) p[i] = 1;
			for(int j=2; i*j<10001; j++){
				prime[i*j] = 0;
			}
		}
	}
	
	while(cin >> n){
		if(n == 0) break;
		for(int i=n; i>0; i--){
			if(p[i] == 1) {
				cout << i-2 << " " << i << endl;
				break;
			}
		}
	}
	
	return 0;

}

C++: #include <stdio.h>

int isprime(int n){
	for(int i=2;i*i<=n;i++){
		if(n%i==0) return 0;
	}
	return 1;
}

int main(){
	int n,i,prime[10000];
	for(i=3;i<10000;i++){
		prime[i]=isprime(i);
	}
	while(1){
		scanf("%d",&n);
		if(n==0){
			break;
		}
		for(i=n;i>=3;i--){
			if(prime[i]==1&&prime[i-2]==1){
				printf("%d %d\n",i-2,i);
				break;
			}
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
bool prime[10002];
int main() {
	for(int i = 2; i * i <= 10000; i++) {
		if(prime[i]) continue;
		for(int j = i * i; j < 10000; j+=i) {
			prime[j] = true;
		}
	}
	int n;
	while(cin >> n,n) {
		for(int i = n; i >= 3; i--) {
			if(!prime[i] && !prime[i-2]) {
				printf("%d %d\n", i - 2, i);
				break;
			}
		}
	}

	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int i,j,n,max,mx;
	int flg[10001];
	while(1) {
		scanf("%d",&n);
		if(n==0) break;
		for(i=2;i<=n;i++) flg[i]=1;
		for(i=2;i*i<=n;i++) {
			if(flg[i]==1) {
				for(j=2;j*i<n;j++) flg[i*j]=0;
			}
		}
		max=-1;
		mx=-1;
		for(i=2;i<n;i++) {
			if(flg[i]==1 && flg[i]==flg[i+2]) {
				if(max<i) max=i;
				if(mx<i+2) mx=i+2;
			}
		}
		printf("%d %d\n",max,mx);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
bool t[999999] = {false};
int main()
{
	int n, c, i, j, d;
	t[0] = true;
	for (i = 2; i * i <= 999999; i++)
	{
		if (!t[i-1])
		{
			for (j = i+i; j <= 999999; j+=i)
				t[j-1] = true;
		}
	}
	while (cin >> n, n)
	{
		for (i = n; i >= 5; i--)
		{
			if ((!t[i-1]) && (!t[i-3]))
			{
				cout << i-2 << " " << i << endl;
				break;
			}
		}
	}
}