#include <iostream>
#include <cmath>
#include <vector>
using namespace std;

struct twinPrime {
    int p;
    int q;
};

twinPrime make_twinPrime(int x, int y) {
    twinPrime myTwinPrime = {x, y};
    return myTwinPrime;
}

int main() {
    const int numPrimes = 10005;
    bool primes[numPrimes];
    for (int i = 2; i != numPrimes; ++i) {
        primes[i] = true;
    }

    for (int i = 2; i != int(sqrt(numPrimes)); ++i) {
        if (primes[i]) {        
            for (int j = 2; i * j < numPrimes; ++j) {
                primes[i*j] = false;
            }
        }
    }

    int previous = 2;
    vector<twinPrime> allTwinPrimes;

    for (int i = 2; i != numPrimes; ++i) {
        if (primes[i]) {
            if (i - previous == 2) {
                allTwinPrimes.push_back(make_twinPrime(previous, i));
            }
            previous = i;
        }
    }

    int n;
    while (cin >> n && n != 0) {
        int maxP = 0, maxQ = 0;
        for (int i = 0; i != allTwinPrimes.size(); ++i) {
            if (allTwinPrimes[i].q > n) {
                maxP = allTwinPrimes[i-1].p;
                maxQ = allTwinPrimes[i-1].q;
                break;
            }
        }
        cout << maxP << " " << maxQ << endl;
    }
    return 0;
}