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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int maxsize(0);
	vector<int> input;

	while (1)
	{
		int tmp;

		cin >> tmp;

		if (!tmp)
		{
			break;
		}

		input.push_back(tmp);

		(maxsize < tmp) ? (maxsize = tmp) : (0);
	}

	vector<int> prime, ans;

	for (int i(2); i <= maxsize; ++i)
	{
		for (vector<int>::iterator i2(prime.begin()), n2(prime.end()); i2 != n2; ++i2)
		{
			if ((i % *i2) == 0)
			{
				goto nx;
			}
		}

		prime.push_back(i);
		
		if (i != *prime.begin() && binary_search(prime.begin(), prime.end(), i - 2))
		{
			ans.push_back(i);
		}
		nx:;
	}

	for (vector<int>::iterator i(input.begin()), n(input.end()); i != n; ++i)
	{
		int out(*(--upper_bound(ans.begin(), ans.end(), *i)));

		cout << out - 2 << ' ' << out << endl;
	}	

	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;






int main() {
	vi v(10010, 1);
	v[0] = 0;
	v[1] = 1;
	for (int i = 2; i < 10010; i++) {
		if (v[i] == 1) {
			for (int j = 2; j <= 10010 / i; j++) {
				v[i*j] = 0;
			}
		}
	}
	int n;
	while (cin >> n&&n > 0) {
		int ans = 5;
		for (int i = n; i > 1; i--) {
			if (v[i] && v[i - 2]) {
				ans = i;
				break;
			}
		}
		cout << ans - 2 << " " << ans << endl;
	}
}

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 v,k;
		while(1){
			scanf("%d",&v);
			if(v==0)break;
			for(k=v;k>=0;k--){
				if(isprime(k)==1 && isprime(k-2)==1){
					printf("%d %d\n",k-2,k);
					break;
				}
			}
		}
		return 0;
	}

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

const int MAX = 100001;
char p[MAX] = {0};

int main(){
	for(int i=2 ; i < MAX ; i++ ) p[i] = 1;
	for(int i=2 ; i*i < MAX ; i++ ){
		if( p[i] ){
			for(int j=i+i ; j < MAX ; j += i ){
				p[j] = 0;
			}
		}
	}
	
	int n;
	while( cin >> n , n ){
		int a, b;
		for(int i=2 ; i <= n ; i++ ){
			if( p[i-2] && p[i] ){
				a = i-2;
				b = i;
			}
		}
		cout << a << " " << b << endl;
	}
}

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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  constexpr int max = 10000;
  vector<bool> isPrime(max, true);
  isPrime[0] = isPrime[1] = false;
  for (int i = 2; i * i < max; i++) {
    if (isPrime[i]) {
      for (int j = i * 2; j < max; j += i) {
        isPrime[j] = false;
      }
    }
  }
  int n;
  while (cin >> n, n) {
    for (int i = n; i >= 5; i--) {
      if (isPrime[i] && isPrime[i - 2]) {
        cout << i - 2 << " " << i << "\n";
        break;
      }
    }
  }
}

C++: #include<iostream>
#include<fstream>
#include<vector>
#define N 10000

int gcd(int q1,int p1){
    if(q1%p1==0) return p1;
    return gcd(p1,q1%p1);
}

int sosu(int j){
    if(j<2)return 0;
    if(j==2)return 1;
    if(j%2==0)return 0;
    for(int i=3; i<=j; i++){
        if(j%i==0)return 0;
    }
    return 1;
}

int main(){
    std::vector<int> n;
    n.resize(N);
    for(int i=0; i<N; i++){
        std::cin >> n[i];
        if(n[i]==0)break;
    }
    for(int i=0; i<N; i++){
        if(n[i]==0)break;
        for(int j=n[i]; j>5; j--){
            if(sosu(j)&&sosu(j-2))
                if(gcd(j,j-2)==1){
                    std::cout << j-2 << " " << j <<std::endl;
                    break;
                }
            }
        }
    return 0;
}

C++: #include <iostream>
#define MAX 10001
int prime[MAX];

void make_prime()
{
	int i,j;
	for(i=2; i<MAX; i++)prime[i]=1;
	for(i=2; i*i<MAX; i++)
		for(j=i*2; j<MAX; j+=i)prime[j]=0;
}
int main()
{
	int n;
	make_prime();
	while(std::cin>>n,n){
		for(int i=n; i>2; i--)
			if( prime[i] && prime[i-2] ){
				printf("%d %d\n",i-2,i);
				break;
			}
	}
	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;
	int sousi[2];
	int prime[10100][2];
	for (i = 0; i < 10100; i++) {
		prime[i][0] = i;
	}
	while(1) {
		sousi[0] = 0;
		sousi[1] = 0;	 
		scanf("%d",&n);
		for (i = 0; i < 10100; i++) {
			prime[i][1] = 0;
		}
		if(n == 0) {
			break;
		}
		for(i = 0; i <= n; i++) {
			prime[i][1] = isprime(prime[i][0]);
		}
		for(i = n; i > 2; i--) {
			if(prime[i][1] == 1 && prime[i - 2][1] == 1) {
				sousi[0] = prime[i - 2][0];
				sousi[1] = prime[i][0];
				break;
			}
		}
		printf("%d %d\n",sousi[0],sousi[1]);
	}
	return 0;
}

C++: #include<stdio.h>

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

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

using namespace std;

const int MAXN = 10100;
bool sieve[MAXN] = {true, true};

int main(){
  for (int i = 2; i * i < MAXN; i++){
    if (sieve[i]) continue;
.   for (int j = i * i; j < MAXN; j += i) sieve[j] = true;
. }
. int N;
. while (cin >> N, N){
    while (sieve[N] or sieve[N - 2]) N--;
.   cout << N - 2 << " " << N << endl;
  }
  return 0;
}

C++: #include<stdio.h>

bool f[10003];

bool f2[10003];


int main(){

for(int i=0;i<10002;i++)
for(int j=2;j*j<=i;j++)
{if(i%j!=0)f[i]=true;
else{ f[i]=false;break;}
}
f[3]=true;f[5]=true;

for(int i=0;i<10002;i++) 
if(f[i]==true&&f[i+2]==true)f2[i]=true;
f2[5]=true;
int n;
while(1){
scanf("%d",&n);if(n==0)break;
int p=0,q=0;
for(int i=n-2;i>=5;i--)
if(f2[i]==true){q=i+2;p=i;break;}
if(n<=6){p=3;q=5;}
printf("%d %d\n",p,q);
}
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; 
 	}
	

#include <stdio.h>

int p[10001];

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

int main(void)
{
  	int i, n;
	int p[10001];
	for ( i= 0; i<10001; i++){
		p[i] = isprime(i);
	}
	 
	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;
}