~cpp
//10168
#include <iostream>
#include <cmath>
#include <ctime>
using namespace std;
#define PRIME_TABLE_SIZE 100
int primeTable[PRIME_TABLE_SIZE];
int primeCnt = 0;
void makePrimeTable()
{
int i, j;
primeTable[primeCnt++] = 2;
for (i = 3; primeCnt < PRIME_TABLE_SIZE; i += 2)
{
for (j = 0; j < primeCnt; j++)
{
if (i % primeTable[j] == 0)
break;
else if (i / primeTable[j] <= primeTable[j])
{
primeTable[primeCnt++] = i;
break;
}
}
}
}
bool isPrime(int n)
{
int i;
if (n != 2 && n % 2 == 0)
return false;
for (i = 3; i <= sqrt(n); i += 2)
{
if (n % i == 0)
return false;
}
return true;
}
int main()
{
int input;
int sumOfThreePrimes;
int primes[4] = {0};
int i, j, k;
makePrimeTable();
while (cin >> input)
{
primes[0] = primes[1] = primes[2] = primes[3] = 0;
for (i = input - 6; i >= 2; i--)
{
if (isPrime(i))
{
primes[0] = i;
sumOfThreePrimes = input - i;
break;
}
}
if (primes[0] == 0)
{
cout << "Impossible." << endl;
continue;
}
for (i = 0; i < 100; i++)
for (j = 0; j < 100; j++)
for (k = 0; k < 100; k++)
{
if (sumOfThreePrimes == primeTable[i] + primeTable[j] + primeTable[k])
{
primes[1] = primeTable[i];
primes[2] = primeTable[j];
primes[3] = primeTable[k];
i = j = k = 100;
}
}
cout << primes[0] << " " << primes[1] << " " << primes[2] << " " << primes[3] << endl;
}
return 0;
}