#include <iostream>
#include <type_traits>
#include <vector>
#include <cstdint>
#include <queue>
#include <algorithm>
#include <cassert>
#include <limits>
#include <random>
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0150&lang=ja"

using i32   = int32_t;
using i64   = int64_t;
using u32   = uint32_t;
using u64   = uint64_t;
using uint  = unsigned int;
using usize = std::size_t;
using ll    = long long;
using ull   = unsigned long long;
using ld    = long double;
template<typename T, usize n>
using arr = T (&)[n];
template<typename T, usize n>
using c_arr = const T (&)[n];
template<typename T>
using max_heap = std::priority_queue<T>;
template<typename T>
using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
T in()
{
    T v;
    return std::cin >> v, v;
}
template<typename T, typename Uint, usize n, usize i>
T in_v(typename std::enable_if<(i == n), c_arr<Uint, n>>::type) { return in<T>(); }
template<typename T, typename Uint, usize n, usize i>
auto in_v(typename std::enable_if<(i < n), c_arr<Uint, n>>::type& szs)
{
    const usize s = (usize)szs[i];
    std::vector<decltype(in_v<T, Uint, n, i + 1>(szs))> ans(s);
    for (usize j = 0; j < s; j++) { ans[j] = in_v<T, Uint, n, i + 1>(szs); }
    return ans;
}
template<typename T, typename Uint, usize n>
auto in_v(c_arr<Uint, n> szs) { return in_v<T, Uint, n, 0>(szs); }
template<typename... Types>
auto in_t() { return std::tuple<std::decay_t<Types>...>{in<Types>()...}; }

int out() { return 0; }
template<typename T>
int out(const T& v) { return std::cout << v, 0; }
template<typename T>
int out(const std::vector<T>& v)
{
    for (usize i = 0; i < v.size(); i++) {
        if (i > 0) { std::cout << ' '; }
        out(v[i]);
    }
    return 0;
}
template<typename T1, typename T2>
int out(const std::pair<T1, T2>& v) { return out(v.first), std::cout << ' ', out(v.second), 0; }
template<typename T, typename... Args>
int out(const T& v, const Args... args) { return out(v), std::cout << ' ', out(args...), 0; }
template<typename... Args>
int outln(const Args... args) { return out(args...), std::cout << '\n', 0; }
template<typename... Args>
void outel(const Args... args) { return out(args...), std::cout << std::endl, 0; }
#    define SHOW(...) static_cast<void>(0)


template<typename T> constexpr T popcount(const T u) { return u ? static_cast<T>(__builtin_popcountll(static_cast<u64>(u))) : static_cast<T>(0); }
template<typename T> constexpr T log2p1(const T u) { return u ? static_cast<T>(64 - __builtin_clzll(static_cast<u64>(u))) : static_cast<T>(0); }
template<typename T> constexpr T msbp1(const T u) { return log2p1(u); }
template<typename T> constexpr T lsbp1(const T u) { return __builtin_ffsll(u); }
template<typename T> constexpr T clog(const T u) { return u ? log2p1(u - 1) : static_cast<T>(u); }
template<typename T> constexpr bool ispow2(const T u) { return u and (static_cast<u64>(u) & static_cast<u64>(u - 1)) == 0; }
template<typename T> constexpr T ceil2(const T u) { return static_cast<T>(1) << clog(u); }
template<typename T> constexpr T floor2(const T u) { return u == 0 ? static_cast<T>(0) : static_cast<T>(1) << (log2p1(u) - 1); }
template<typename T> constexpr bool btest(const T mask, const usize ind) { return static_cast<bool>((static_cast<u64>(mask) >> ind) & static_cast<u64>(1)); }
template<typename T> void bset(T& mask, const usize ind) { mask |= (static_cast<T>(1) << ind); }
template<typename T> void breset(T& mask, const usize ind) { mask &= ~(static_cast<T>(1) << ind); }
template<typename T> void bflip(T& mask, const usize ind) { mask ^= (static_cast<T>(1) << ind); }
template<typename T> void bset(T& mask, const usize ind, const bool b) { (b ? bset(mask, ind) : breset(mask, ind)); }
template<typename T> constexpr T bcut(const T mask, const usize ind) { return ind == 0 ? static_cast<T>(0) : static_cast<T>((static_cast<u64>(mask) << (64 - ind)) >> (64 - ind)); }

class xoshiro
{
public:
    using result_type = uint32_t;
    static constexpr result_type min() { return std::numeric_limits<result_type>::min(); }
    static constexpr result_type max() { return std::numeric_limits<result_type>::max(); }
    xoshiro() : xoshiro(std::random_device{}()) {}
    xoshiro(uint64_t seed)
    {
        uint64_t z = 0;
        for (int i = 0; i < 4; i++) { z = (seed += 0x9e3779b97f4a7c15), z = (z ^ (z >> 33)) * 0x62A9D9ED799705F5, z = (z ^ (z >> 28)) * 0xCB24D0A5C88C35B3, s[i] = static_cast<result_type>(z >> 32); }
    }
    result_type operator()()
    {
        const result_type result = rotl(s[1] * 5, 7) * 9, t = s[1] << 9;
        return s[2] ^= s[0], s[3] ^= s[1], s[1] ^= s[2], s[0] ^= s[3], s[2] ^= t, s[3] = rotl(s[3], 11), result;
    }
    void discard(const usize rep)
    {
        for (usize i = 0; i < rep; i++) { (*this)(); }
    }

private:
    result_type s[4];
    static result_type rotl(const result_type x, const int k) { return (x << k) | (x >> (32 - k)); }
};
class xoshiro_64
{
public:
    using result_type = uint64_t;
    static constexpr result_type min() { return std::numeric_limits<result_type>::min(); }
    static constexpr result_type max() { return std::numeric_limits<result_type>::max(); }
    xoshiro_64() : xoshiro_64(std::random_device{}()) {}
    xoshiro_64(uint64_t seed)
    {
        uint64_t z = 0;
        for (int i = 0; i < 4; i++) { z = (seed += 0x9e3779b97f4a7c15), z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9, z = (z ^ (z >> 27)) * 0x94d049bb133111eb, s[i] = static_cast<result_type>(z ^ (z >> 31)); }
    }
    result_type operator()()
    {
        const result_type result = rotl(s[1] * 5, 7) * 9, t = s[1] << 17;
        return s[2] ^= s[0], s[3] ^= s[1], s[1] ^= s[2], s[0] ^= s[3], s[2] ^= t, s[3] = rotl(s[3], 45), result;
    }
    void discard(const usize rep)
    {
        for (usize i = 0; i < rep; i++) { (*this)(); }
    }

private:
    result_type s[4];
    static result_type rotl(const result_type x, const int k) { return (x << k) | (x >> (64 - k)); }
};
template<typename Rng>
class rng_base
{
public:
    using rng_type    = Rng;
    using result_type = typename rng_type::result_type;
    static constexpr result_type min() { return rng_type::min(); }
    static constexpr result_type max() { return rng_type::max(); }
    rng_base() : rng_base(std::random_device{}()) {}
    rng_base(const u64 seed) : rng(seed) {}
    ~rng_base() = default;
    result_type operator()(const result_type max = std::numeric_limits<result_type>::max())
    {
        if (max == std::numeric_limits<result_type>::max()) { return static_cast<result_type>(rng()); }
        if (ispow2(max + 1)) { return static_cast<result_type>(rng() & max); }
        const result_type mask = static_cast<result_type>(ceil2(static_cast<u64>(max + 1))) - 1;
        while (true) {
            const result_type ans = static_cast<result_type>(rng() & mask);
            if (ans <= max) { return ans; }
        }
    }
    template<typename Int = result_type>
    Int operator()(const Int min, const Int max) { return min + (Int)(*this)(max - min); }
    operator bool() { return (bool)(*this)(0, 1); }
    template<typename Int> std::pair<Int, Int> pair(const Int min, const Int max) { return std::pair<Int, Int>{*this(min, max), *this(min, max)}; }
    template<typename Int>
    std::vector<Int> vec(const usize n, const Int min, const Int max)
    {
        std::vector<Int> v(n);
        for (usize i = 0; i < n; i++) { v[i] = (*this)(min, max); }
        return v;
    }
    std::vector<usize> perm(const usize n)
    {
        std::vector<usize> ans(n);
        std::iota(ans.begin(), ans.end(), 0UL);
        std::shuffle(ans.begin(), ans.end(), rng);
        return ans;
    }

private:
    Rng rng;
};
using rng_mt        = rng_base<std::mt19937>;
using rng_mt64      = rng_base<std::mt19937_64>;
using rng_xoshiro   = rng_base<xoshiro>;
using rng_xoshiro64 = rng_base<xoshiro_64>;
rng_mt g_rng_mt;
rng_mt64 g_rng_mt64;
rng_xoshiro g_rng_xo;
rng_xoshiro64 g_rng_xo64;
template<typename T, typename V>
inline bool miller_rabin(const T& n, const std::vector<T>& as)
{
    auto pow = [&](auto&& self, const V& a, const T k) -> V {
        if (k == 0) { return 1; }
        if (k % 2 == 0) {
            return self(self, (a * a) % V(n), k / 2);
        } else {
            return (self(self, a, k - 1) * a) % V(n);
        }
    };
    T d = n - 1;
    for (; (d & 1) == 0; d >>= 1) {}
    for (const T& a : as) {
        if (n <= a) { break; }
        T s = d;
        V x = pow(pow, a, s);
        while (x != 1 and x != n - 1 and s != n - 1) {
            (x *= x) %= V(n);
            s *= 2;
        }
        if (x != n - 1 and s % 2 == 0) { return false; }
    }
    return true;
}
template<typename T>
inline bool is_prime(const T& n, const usize trial)
{
    if (n % 2 == 0) { return n == 2; }
    std::vector<T> as(trial);
    for (usize i = 0; i < trial; i++) { as[i] = static_cast<T>(g_rng_xo64(T{2}, n - 2)); }
    return miller_rabin<T, T>(n, as);
}
inline bool is_prime(const ull n)
{
    if (n % 2 == 0) { return n == 2; }
    if (n < (1ULL << 32)) {
        return miller_rabin<uint, ull>((uint)n, std::vector<uint>{2, 7, 61});
    } else {
        return miller_rabin<ull, __uint128_t>(n, std::vector<ull>{2, 325, 9375, 28178, 450775, 9780504});
    }
}
int main()
{
    constexpr usize N = 10000;
    std::vector<bool> isp(N + 1, false);
    for (uint m = 2; m <= N; m++) { isp[m] = is_prime(m); }
    std::vector<uint> ans;
    for (uint m = 5; m <= N; m += 2) {
        if (isp[m - 2] and isp[m]) { ans.push_back(m); }
    }
    while (true) {
        const uint n = in<uint>();
        if (n == 0) { break; }
        const uint p = *std::prev(upper_bound(ans.begin(), ans.end(), n));
        outln(p - 2, p);
    }
    return 0;
}

