//
// Written by Fyodor Menshikov 17.02.2009
// 14:33-14:53
//

import java.io.*;
import java.util.*;

class Main {

   Scanner in;
   PrintWriter out;

   void asserT(boolean e) {
      if (!e) {
         throw new Error();
      }
   }

   void solve() {
      int n = in.nextInt();
      asserT(1 <= n && n <= 1000);
      final int LEN = 35;
      asserT(LEN % 2 == 1);
      int a[][] = new int[LEN][LEN];
      for (int i = 0; i < LEN; i++) {
         for (int j = 0; j < LEN; j++) {
            if (i == 0 || j == 0 || i == LEN - 1 || j == LEN - 1) {
               a[i][j] = -1;
            }
         }
      }
      {
         int i = 1;
         int j = 1;
         int di = 0;
         int dj = 1;
         int value = (LEN - 2) * (LEN - 2) - 1;
         while (a[i][j] == 0) {
            a[i][j] = value;
            value--;
            if (a[i + di][j + dj] != 0) {
               int oldDi = di;
               int oldDj = dj;
               di = oldDj;
               dj = -oldDi;
            }
            i += di;
            j += dj;
         }
      }
      TreeSet<Integer> ans = new TreeSet<Integer>();
      for (int i = 2; i < LEN - 2; i++) {
         for (int j = 2; j < LEN - 2; j++) {
            for (int di = -1; di <= 1; di++) {
               for (int dj = -1; dj <= 1; dj++) {
                  if (di * di + dj * dj > 0) {
                     if (a[i][j] + a[i + di][j + dj] == n) {
                        ans.add(Math.min(a[i][j], a[i + di][j + dj]));
                     }
                  }
               }
            }
         }
      }
      out.println(ans.first() + " " + (n - ans.first()));
   }

   void run() {
      try {
         in = new Scanner(System.in);
         out = new PrintWriter(System.out);
      } catch (Exception e) {
         throw new Error(e);
      }
      try {
         solve();
      } finally {
         out.close();
      }
   }

   public static void main(String args[]) {
      new Main().run();
   }
}