Associated Course(s):
Sudo Placement 2019

Given an even number (greater than 2), return two prime numbers whose sum will be equal to given number. There are several combinations possible. Print only first such pair.

**NOTE:** A solution will always exist, read Goldbach’s conjecture. Also, solve the problem in linear time complexity, i.e., O(n).

**Input:**

The first line contains T, the number of test cases. The following T lines consist of a number each, for which we'll find two prime numbers.

**Note**: The number would always be an even number.

**Output:**

For every test case print two prime numbers space separated, such that the smaller number appears first. Answer for each test case must be in a new line.

**Constraints:**

1 ≤ T ≤ 70

1 ≤ N ≤ 10000

**Example:**

**Input:**

5

74

1024

66

8

9990

**Output:**

3 71

3 1021

5 61

3 5

17 9973

Author: madhuradlakha

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

RatneshTiwari3 | 24 |

AnmolPassi | 20 |

Swords | 20 |

baranwalsuraj96 | 17 |

tarun711 | 16 |

Bishnu Dev Panda | 727 |

yk12 | 512 |

DevMittal | 472 |

okayboss | 458 |

VijethaShastri | 431 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4921 |

Quandray | 4547 |

Login to report an issue on this page.