description: Polycarp has found a table having an infinite number of rows and columns. The rows are numbered from 1, starting from the topmost one. The columns are numbered from 1, starting from the leftmost one.
  
  Initially, the table hasn't been filled and Polycarp wants to fix it. He writes integers from 1 and so on to the table as follows.
  
  <image> The figure shows the placement of the numbers from 1 to 10. The following actions are denoted by the arrows.
  
  The leftmost topmost cell of the table is filled with the number 1. Then he writes in the table all positive integers beginning from 2 sequentially using the following algorithm.
  
  First, Polycarp selects the leftmost non-filled cell in the first row and fills it. Then, while the left neighbor of the last filled cell is filled, he goes down and fills the next cell. So he goes down until the last filled cell has a non-filled neighbor to the left (look at the vertical arrow going down in the figure above).
  
  After that, he fills the cells from the right to the left until he stops at the first column (look at the horizontal row in the figure above). Then Polycarp selects the leftmost non-filled cell in the first row, goes down, and so on.
  
  A friend of Polycarp has a favorite number k. He wants to know which cell will contain the number. Help him to find the indices of the row and the column, such that the intersection of the row and the column is the cell containing the number k.
  
  Input
  
  The first line contains one integer t (1 ≤ t ≤ 100) — the number of test cases. Then t test cases follow.
  
  Each test case consists of one line containing one integer k (1 ≤ k ≤ 10^9) which location must be found.
  
  Output
  
  For each test case, output in a separate line two integers r and c (r, c ≥ 1) separated by spaces — the indices of the row and the column containing the cell filled by the number k, respectively.
  
  Example
  
  Input
  
  
  7
  11
  14
  5
  4
  1
  2
  1000000000
  
  
  Output
  
  
  2 4
  4 3
  1 3
  2 1
  1 1
  1 2
  31623 14130
solution: import java.util.*;
  import java.io.*;
  
  public class C_1560 {
  	public static void main(String[] args) throws Exception {
  		Scanner sc = new Scanner(System.in);
  		PrintWriter pw = new PrintWriter(System.out);
  		
  		int t = sc.nextInt();
  		while(t-->0) {
  			int k = sc.nextInt();
  			int start = 1, end = (int)(Math.sqrt(1e9) + 5);
  			while(start < end) {
  				int mid = (start + end) >> 1;
  				if(mid * mid >= k)
  					end = mid;
  				else
  					start = mid + 1;
  			}
  			
  			k -= (start - 1) * (start - 1);
  			if(k <= start)
  				pw.println(k + " " + start);
  			else
  				pw.println(start + " " + (start - (k - start)));
  		}
  		
  		pw.flush();
  	}
  
  	public static class Scanner {
  		StringTokenizer st;
  		BufferedReader br;
  
  		public Scanner(InputStream system) {
  			br = new BufferedReader(new InputStreamReader(system));
  		}
  
  		public Scanner(String file) throws Exception {
  			br = new BufferedReader(new FileReader(file));
  		}
  
  		public String next() throws IOException {
  			while (st == null || !st.hasMoreTokens())
  				st = new StringTokenizer(br.readLine());
  			return st.nextToken();
  		}
  
  		public String nextLine() throws IOException {
  			return br.readLine();
  		}
  
  		public int nextInt() throws IOException {
  			return Integer.parseInt(next());
  		}
  
  		public double nextDouble() throws IOException {
  			return Double.parseDouble(next());
  		}
  
  		public char nextChar() throws IOException {
  			return next().charAt(0);
  		}
  
  		public long nextLong() throws IOException {
  			return Long.parseLong(next());
  		}
  
  		public int[] nextIntArray(int n) throws IOException {
  			int[] array = new int[n];
  			for (int i = 0; i < n; i++)
  				array[i] = nextInt();
  			return array;
  		}
  
  		public Integer[] nextIntegerArray(int n) throws IOException {
  			Integer[] array = new Integer[n];
  			for (int i = 0; i < n; i++)
  				array[i] = new Integer(nextInt());
  			return array;
  		}
  
  		public long[] nextLongArray(int n) throws IOException {
  			long[] array = new long[n];
  			for (int i = 0; i < n; i++)
  				array[i] = nextLong();
  			return array;
  		}
  
  		public double[] nextDoubleArray(int n) throws IOException {
  			double[] array = new double[n];
  			for (int i = 0; i < n; i++)
  				array[i] = nextDouble();
  			return array;
  		}
  
  		public static int[] shuffle(int[] a) {
  			int n = a.length;
  			Random rand = new Random();
  			for (int i = 0; i < n; i++) {
  				int tmpIdx = rand.nextInt(n);
  				int tmp = a[i];
  				a[i] = a[tmpIdx];
  				a[tmpIdx] = tmp;
  			}
  			return a;
  		}
  
  		public boolean ready() throws IOException {
  			return br.ready();
  		}
  
  		public void waitForInput() throws InterruptedException {
  			Thread.sleep(3000);
  		}
  	}
  }
  