let store = [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}];

function checkDigit(n, dig) {
  if (dig == 0) {
    return { count: int(n == 0 ? 0 : 1), decrement: 0 };
  }
  if (dig > n) {
    return {
      count: int(1),
      decrement: dig - n
    };
  }
  return {
    count: int(2),
    decrement: dig
  };
}

function getNumString(arr) {
  const joined = arr.join("");
  const trimmed = joined.replace(/0/g, " ").trimLeft();
  return trimmed.replace(/\s/g, "0") || "0";
}

function solveCore(n, dig = 0) {
  if (store[dig][n]) {
    return store[dig][n];
  }
  if (n.length === 1) {
    return (store[dig][n] = checkDigit(n, dig));
  }

  let first = n[0];
  let tailArr = n.substring(1).split("");
  let total = int();

  while (first >= 0) {
    const r = solveCore(getNumString(tailArr), Math.max(first, dig));
    total = plus(total, r.count);
    first -= 1;
    tailArr = tailArr.map(() => "9");
    tailArr.pop();
    tailArr.push(`${(10 - r.decrement) % 10}`);
  }

  return (store[dig][n] = { count: total, decrement: 10 - tailArr.pop() });
}

function solve(n) {
  store = [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}];
  const r = solveCore(n, 0);
  console.log(
    n,
    store.map(o => Object.keys(o).length).reduce((acc, c) => acc + c)
  );
  return bintToString(r.count);
}

function* main() {
  const n = yield;
  const r = solve(n);
  console.log(r);
  process.exit(0);
}

if (!module.parent) {
  (() => {
    const q = main();
    q.next();
    require("readline")
      .createInterface({
        input: process.stdin,
        output: null
      })
      .on("line", line => q.next(line));
  })();
}

function int(n = 0) {
  return [
    n,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ];
}
function plus(int1, int2) {
  let z = 0;
  return int1.map((_, i) => {
    z = z + int1[i] + int2[i];
    const r = z % 10;
    z = Math.floor(z / 10);
    return r;
  });
}

function bintToString(i) {
  return getNumString(Array.from(i).reverse());
}

exports.solve = solve;


const DEBUG = false;
const { EOL } = require('os');
const fs = require('fs');

let r = process.stdin;
if (DEBUG) {
  r = fs.createReadStream('input');
}
let data = '';
r.on('data', c => (data += c));
r.on('end', () => {
  const lines = data.split(EOL);
  const arr = [];
  let d;
  [arr[0], arr[1], arr[2], d] = lines[0].split(' ');
  arr[0] = parseInt(arr[0]);
  arr[1] = parseInt(arr[1]);
  arr[2] = parseInt(arr[2]);
  d = parseInt(d);
  arr.sort();
  let res = Math.max(0, d - (arr[1] - arr[0]));
  res += Math.max(0, d - (arr[2] - arr[1]));
  console.log(res);
});


const DEBUG = false;
const { EOL } = require('os');
const fs = require('fs');

let r = process.stdin;
if (DEBUG) {
  r = fs.createReadStream('input');
}
let data = '';
r.on('data', c => (data += c));
r.on('end', () => {
  const lines = data.split(EOL);
  const arr = [];
  let d;
  [arr[0], arr[1], arr[2], d] = lines[0].split(' ').map(parseInt);
  arr.sort(function(a, b) {
    return a - b;
  });
  let res = Math.max(0, d - (arr[1] - arr[0]));
  res += Math.max(0, d - (arr[2] - arr[1]));
  console.log(res);
});


function main(input) {

        let a,b,c;
        let d =[];
        var x=[];
        input =input.split(/\n/g);
        var arr = input[0].split(' ');

        x[0]=arr[0];
        x[1]=arr[1];
        x[2]=arr[2];
        //console.log(x);
        var dis=arr[3];

        x.sort(function(a, b){return a - b});
         //console.log(x);

        d[0]=Math.abs(x[0]-x[1]);
        d[1]=Math.abs(x[0]-x[2]);
        d[2]=Math.abs(x[1]-x[2]);
        //console.log(d);
        var m = Math.min(...d);
        //console.log(m)
        if(m>=dis){
            console.log(0);
        }

        var time=0;
        while(d[0]<dis || d[1]<dis || d[2]<dis){
             if(d[0]<dis){
                 time++
                 x[0]--;
                 d[0]=Math.abs(x[0]-x[1]);
                 d[1]=Math.abs(x[0]-x[2]);
             }
            else if(d[1]<dis){
                 time++
                 x[2]++;
                d[1]=Math.abs(x[0]-x[2]);
                d[2]=Math.abs(x[1]-x[2]);
             }
            else if(d[2]<dis){
                 time++
                 x[2]++;
                d[1]=Math.abs(x[0]-x[2]);
                d[2]=Math.abs(x[1]-x[2]);
             }
             //console.log(d[2]);

        }
        console.log(time);

}

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;
});

process.stdin.on("end", function () {
   main(stdin_input);
});


function main(input) {

        var a,b,c;
        var d =[];
        var x=[];
        input =input.split(/\n/g);
        var arr = input[0].split(' ').map(Number);

        x[0]=arr[0];
        x[1]=arr[1];
        x[2]=arr[2];
        //console.log(x);
        var dis=arr[3];

        x.sort(function(a, b){return a - b});
         //console.log(x);

        d[0]=Math.abs(x[0]-x[1]);
        d[1]=Math.abs(x[0]-x[2]);
        d[2]=Math.abs(x[1]-x[2]);
        //console.log(d);
        var m = Math.min(...d);
        //console.log(m)
        if(m>=dis){
            console.log(0);
        }

        var time=0;
             if(d[0]<dis){
                 time=time+dis-d[0];
                 //console.log(time);
                 x[0]=x[0]-(dis-d[0]);

                 d[0]=Math.abs(x[0]-x[1]);
                 d[1]=Math.abs(x[0]-x[2]);
             }
             //console.log(x);
             //console.log(d);
            if(d[1]<dis){
                 time=time+dis-d[1];
                 //console.log(time);
                 x[2]=x[2]+dis-d[1];
                d[1]=Math.abs(x[0]-x[2]);
                d[2]=Math.abs(x[1]-x[2]);
             }
            // console.log(x);
             //console.log(d);
            if(d[2]<dis){
                 //console.log(time);
                 time=time+dis-d[2];
                  //console.log(time);
                 //console.log(dis-d[2]);
                 x[2]=x[2]+dis-d[2];
                d[1]=Math.abs(x[0]-x[2]);
                d[2]=Math.abs(x[1]-x[2]);
             }
             //console.log(x);
             //console.log(d);

        console.log(time);

}

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;
});

process.stdin.on("end", function () {
   main(stdin_input);
});


let inputString = '';
let currentLine = 0;
process.stdin.on('data', data => {
	inputString += data;
});
process.stdin.on('end', function () {
	inputString = inputString
		.trim()
		.split('\n')
		.map(str => str.trim());
	main();
});

function readLine() {
	return inputString[currentLine++];
}

const store = {};

function main() {
	let [n, a, b] = readLine()
		.split(' ')
		.map(x => x >> 0);
	let m = n - a;

	if (m > b) {
		console.log(b + 1);
	} else {
		console.log(b);
	}
}


let input ='';

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data',(data)=>input+=data)
process.stdin.on('end',()=>{
    let count = 0;
    let tmp = input.split('\n');
    let arr = tmp[1].split(' ').map((val)=>+val).sort();

    for(let i = 0; i < arr.length; i+=2){
        count+=Math.abs(arr[i]-arr[i+1])
    }
   console.log(count)
})


const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });

  let l=0;
  rl.on('line', (input) => {
      if (l==0) {l++}
      else {
           rl.close();
           let s = input.split(" ")
           s.sort()
           let res=0;
           for(let i=0;i<input.length; i+=2){
            let d = s[i+1]-s[i]
            if(d>0) {
                res+=d
            }
        }
        console.log(res)
    return 0;
}
});


let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    console.log(lines);
})

const input = i.split('\n')[1];
const vector = input.split(' ').map(
    n => parseInt(n)
);

const insertionSort = (vector) => {
    let res = 0;

    for (let i = 0; i < vector.length; i++) {
        let minIndex = i;

        for (let j = i + 1; j < vector.length; j++) {
            if (vector[j] < vector[minIndex]) {
                minIndex = j;
            }
        }

        let temp = vector[i];
        vector[i] = vector[minIndex];
        vector[minIndex] = temp;

        if (i !== 0 && i % 2 === 1) {
            res += vector[i] - vector[i -1]
        }
    }

    console.log(res);
};

insertionSort(vector);


let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/

    const input = lines[1];
    const vector = input.split(' ').map(
        n => parseInt(n)
    );

    const insertionSort = (vector) => {
        let res = 0;

        for (let i = 0; i < vector.length; i++) {
            let minIndex = i;

            for (let j = i + 1; j < vector.length; j++) {
                if (vector[j] < vector[minIndex]) {
                    minIndex = j;
                }
            }

            let temp = vector[i];
            vector[i] = vector[minIndex];
            vector[minIndex] = temp;

            if (i !== 0 && i % 2 === 1) {
                res += vector[i] - vector[i -1]
            }
        }

        console.log(res);
    };
});

//////


function main() {
  const is = new Scanner();
  const [n, m] = is.nextArray().map(Number);
  const word = is.nextLine().split('');
  word.forEach((item, index, array) => {
    array[index] = item.charCodeAt(0) - 'a'.charCodeAt(0) + 1;
  });
  word.sort((a, b) => a - b);

  let answer = Infinity;

  function calc(i, accum, number) {
    if (number === m) {
      answer = Math.min(answer, accum);
    }
    if (i === n || number > m) {
      return;
    }

    if (Math.abs(word[i] - word[i + 1]) >= 2) {
      calc(i + 1, accum + word[i + 1], number + 1);
    }
    calc(i + 1, accum, number);
  }

  calc(0, word[0], 1);
  console.log(answer === Infinity ? -1 : answer);
}

/*
 *  Api Scanner
 */

class Scanner {
  constructor() {
    this.index = 0;
    this.lines = stdinInput.trim().split('\n'); // eslint-disable-line
  }

  nextLine() {
    return this.lines[this.index++]; // eslint-disable-line
  }

  nextInt() {
    return parseInt(this.nextLine(), 10);
  }

  nextDouble() {
    return parseFloat(this.nextLine());
  }

  nextArray() {
    return this.nextLine().split(' ');
  }

  hasNext() {
    return this.index < this.lines.length;
  }
}

let stdinInput = '';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', (input) => { stdinInput += input; });
process.stdin.on('end', () => { main(); });


function main() {
  const is = new Scanner();
  const [n, m] = is.nextArray().map(Number);
  const word = is.nextLine().split('');
  word.forEach((item, index, array) => {
    array[index] = item.charCodeAt() - 'a'.charCodeAt() + 1;
  });
  word.sort((a, b) => a - b);

  function theFor(i, j, accum, number) {
    if (m === number) {
      return accum;
    }
    if (j + 1 === n) {
      return -1;
    }

    if (word[j] - word[i] > 1) {
      return theFor(j, j + 1, accum + word[j], number + 1);
    }
    return theFor(i, j + 1, accum, number);
  }

  console.log(theFor(0, 1, word[0], 1));
}

/*
 *  Api Scanner
 */

class Scanner {
  constructor() {
    this.index = 0;
    this.lines = stdinInput.trim().split('\n'); // eslint-disable-line
  }

  nextLine() {
    return this.lines[this.index++]; // eslint-disable-line
  }

  nextInt() {
    return parseInt(this.nextLine(), 10);
  }

  nextDouble() {
    return parseFloat(this.nextLine());
  }

  nextArray() {
    return this.nextLine().split(' ');
  }

  hasNext() {
    return this.index < this.lines.length;
  }
}

let stdinInput = '';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', (input) => { stdinInput += input; });
process.stdin.on('end', () => { main(); });


function main() {
  var n = +nxt(), m = +nxt(), k = +nxt() - 1;
  function ok(val) {
    var a = [];
    a[k] = val;
    var i;
    for (i = k + 1; i < n; ++i) a[i] = Math.max(a[i - 1] - 1, 1);
    for (i = k - 1; i >= 0; --i) a[i] = Math.max(a[i + 1] - 1, 1);
    return a.reduce((x, y) => x + y, 0) <= m;
  }
  var l = 1, r = m;
  while (l < r) {
    var mid = l + ((r - l + 1) >> 1);
    if (ok(mid)) l = mid;
    else r = mid - 1;
  }
  print(l);
}

var line = null, linepos = 0;
function nxt() {
  if (!line || linepos === line.length) {
    line = readline().split(' ');
    linepos = 0;
  }
  return line[linepos++];
}

if (typeof readline == 'undefined') {
  process.stdin.resume();
  process.stdin.setEncoding('ascii');

  var input_stdin = "";
  process.stdin.on('data', function (data) { input_stdin += data; });
  process.stdin.on('end', function () {
    // input_stdin = input_stdin.split(/\s/);
    input_stdin = input_stdin.split('\n');
    var curline = 0;
    readline = () => input_stdin[curline++];
    if (typeof print === 'undefined') print = console.log;
    main();
  });
} else main();


let stdin = process.stdin;
stdin.setEncoding('utf8');
stdin.on('data', function (data) {
    let input = data.split('\n');
    console.log(solution(input[0]; input[1]));
});

const solution = (cardOnTable, cardsInHand) => {
  if (cardsInHand.indexOf(cardOnTable[0]) >= 0 || cardsInHand.indexOf(cardOnTable[1]) >= 0){
	return "YES";
  } else {
	return "NO";
  }
};


const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let hand = []
rl.on('line', (input) => {
        rl.close();
        let n = parseInt(input)
        if((n-2)%3===0)
         console.log(1,2,n-3)
        else
         console.log(1,1,n-2)
    return
})


const readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.on('line', function (line1) {
    let cardOnTable = line1;
    rl.on('line', function (line2) {
        let cardsInHand = line2;
        doIt(cardOnTable, cardsInHand)
        rl.close();
    });
});

function doIt(cardOnTable, cardsInHand) {
    const splitedCardOnTable = splitCard(cardOnTable);

    let ret = 'NO';
    for (let i = 0 ;i < cardsInHand.length; i++) {
        const splited = splitCard(cardsInHand[i]);
        if (splited[0] === splitedCardOnTable[0] || splited[1] === splitedCardOnTable[1]) {
            ret ='YES';
            break;
        }
    }

    console.log(ret);

    function splitCard(card) {
        const rank = card.substring(0,1);
        const suit = card.substring(1,2);
        return [rank, suit];
    };
}


  const readline = require('readline');

  const rl = readline.createInterface({
      input: process.stdin,
      output: process.stdout
  });

  rl.question('', (value) => {
      let s = value;
      let isPalindrome = true;
      let oneLetter = true;
      console.log(Math.floor(s.length/2));
      for(let idx = 0; idx < Math.floor(s.length/2) && isPalindrome; idx += 1){
        console.log('aa',idx);
        if(s.charAt(idx) != s.charAt(s.length-idx-1)){
          console.log('bb');
          isPalindrome = false;
        }
        if(s[idx] !== s[idx+1] && oneLetter){
          oneLetter = false;
        }
      }
      if(!isPalindrome){
        console.log(s.length);
      }else if(oneLetter) {
        console.log(0);
      }else {
        console.log(s.length-1);
      }
      rl.close();

  });


const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.on('line', function(line){
    console.log(solve(line))
  })

function solve(line){
    n = parseInt(line)
    var cnt = 0;
    while(n != 0){
        var d = n%10
        n = Math.floor(n / 10)
        if(d == 7 || d == 4)
            cnt++
    }
    if(cnt == 7 || cnt == 4)
        return 'YES'
    else
        return 'NO'
}


var line_number = 0;
const cs = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

var lines = {};
cs.on("line", (input) => {
  if (input == "") {
    cs.close();
  }
  lines[line_number] = input.split(" ");
  line_number += 1;
}).on("close", () => {
  main();
  process.exit();
});

function isOp(str) {
  return str.length === 1 && str.match(/[<=>]/);
}
function isChr(str) {
  return str.length === 1 && str.match(/[a-z]/i);
}
function isInt(str) {
  return str.length === 1 && str.match(/[0-9*]/);
}

function print(str) {
  console.log(str);
}

function exit(status = 0) {
  process.exit(status);
}

function predict(test) {
  let op = "";
  let ops = [];
  let opVariables = [];
  let limits = [];
  for (let t of test) {
    // console.log(t);
    for (let i = 0; i < t.length; i++) {
      if (isOp(t[i])) {
        op = t[i];
        if (isOp(t[i + 1])) {
          op += t[i + 1];
          i += 1;
        }
        ops.push(op);
        op = "";
      } else if (isChr(t[i])) {
        // console.log(t[i])
        op = t[i];
        for (var j = i + 1; j < t.length; j++) {
          if (isChr(t[j]) || isInt(t[j])) {
            op += t[j];
            i = j;
          } else break;
        }
        opVariables.push(op);
        op = "";
      } else {
        if (i == 0 || (i > 0 && isOp(t[i - 1]))) {
          op = t[i];
          let j = i + 1;
          for (; j < t.length; j++) {
            if (isInt(t[j])) {
              op += t[j];
              i = j;
            } else break;
          }
          limits.push(op);
          op = "";
        }
      }
    }
  }

  let min = limits[0];
  let max = limits[1];

  let pvs = ops.map((o, i) => [o, opVariables[i]]);

  for (let pv of pvs) {
    if (pv[1] == undefined) {
      pv[1] = max;
    }
    // print(`${min} ${pv[0]} ${pv[1]} ?`)
    if (eval(`${min}${pv[0]}${pv[1]}`)) {
      // print(` ${min} ${pv[0]} ${pv[1]} true`)
      min = pv[1];
    } else {
      print("input error");
      exit();
    }
  }
}

var n;
function main() {
  n = BigInt(lines[0][0])
  predict(["1<=n<=10**18"]);
  print(n);
  let c = 0
  do {
    x = n % 10n;
    if (x == 4 || x == 7) {
      c += 1;
    }
  } while ((n = BigInt(n / 10n)) != 0);

  if( c == 4 || c == 7) {
    print("YES")
  }
  else{
    print("NO")
  }
}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.on('line', (line) => {
    console.log(solution(line));
});

function solution(input) {
    for (let i = 0 ; i < input.length; i++) {
        if (!(input[i] === '4' || input[i] === '7')) {
            return 'NO';
        }
    }

    // default
    return 'YES';

}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', (d) => {
  let ans = 'NO';
  let count = 0;

  for (let i = 0; i < d.length; i++) {
    if (d[i] === '7' || d[i] === '4') {
      count++;
    }
  }

  if (count === d.length || count === 7 || count === 4) {
    ans = 'YES';
  }

  console.log(ans);
});


'use strict';

function tester(num) {
  let strs = String(num);
  let countHappyNumbers = 0;

  for (let i = 0; i < strs.length; i++) {
    let str = strs.charAt(i);

    isHappyNumber(str) && countHappyNumbers++;
  }

  console.log(isHappyNumber(countHappyNumbers) ? 'YES' : 'NO');
}

function isHappyNumber(n) {
  return Number(n) === 4 || Number(n) === 7;
}

module.exports = tester;


const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.on('line', (input) => {
    lucky = 0;
    for(let i = 0; i < input.length; i++) {
        if(input[i] == 4 || input[i] == 7) {
            lucky +=1;
        } else {
            console.log('NO');
            return rl.close();
        }
    }
    if(lucky == 4 || lucky == 7) {
        console.log('YES');
    } else {
        console.log('NO');
    }

    rl.close();
});


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}

function main() {
    let numberString = readLine();
    let numberArray = numberString.split('');
    let luckyDigits = [];
    for (let i = 0; i < numberArray.length; i++) {
        if (numberArray[i] === '7' || numberArray[i] === 4) {
            luckyDigits.push(numberArray[i]);
        }
    }
    if (luckyDigits.length === 7 || luckyDigits.length === 4) {
        console.log('YES');
    } else {
        console.log('NO');
    }
}


'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function readAsInt(){
  return parseInt(readline());
}

function readAsIntList(){
  return readline().split(' ').filter(i => i).map(i => parseInt(i));
}

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  let s = readline();
  console.log(s.match(/^[47]+$/i) && s.includes('7') && s.includes('4') ? 'YES' : 'NO' );
}


let fs = require("fs");

let txt = fs.readFileSync(0, "utf-8").split("\r\n").filter(data => {
    return data.length > 0
})
for (let index = 0; index < txt.length; index++) {
    doit(txt[index].split("").map(data => {
        return data * 1
    }))
}

function doit(tab) {
    let t = tab.filter(data => {
        return data != 7 && data != 4;
    }).length;
    if (t == 0) {
        console.log("YES");
    } else {
        t = tab.length - t
        if ((t % 4 == 0 || t % 7 == 0 )&& t!=0) {
            console.log("YES");
        } else {
            console.log("NO");
        }
    }

}


// Sample code to perform I/O:

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

function main(input) {
    let output = nameLookUp(input);
    process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(str) {
    let input = str.trim();
    let luckyNumber = ['4', '7'];
    let strFlag = 'YES';
    for (let str of input) {
        if (luckyNumber.indexOf(str) === -1) {
            strFlag = 'No';
            break;
        }
    }
    return strFlag.toString();
}


'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    let num = readLine()
        .split('')
        .map(value => parseInt(value));
    let only7and4 = num.filter((value) => {
        return value == 7 || value == 4;
    })
    if (only7and4.length == num.length) {
        console.log('YES');
    } else console.log('NO');
}


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}

function main() {
    let number = parseInt(readLine());
    // let number = parseInt(numberString);
    // let n = numberString.length;
    // let result = (2 * (Math.pow(2, n) - 1)) / (2 - 1);
    // if (numberString[n - 1] === '4') {
    //     result = result - 1;
    // }
    // let count = 0;
    // for (let i = 4; i <= number; i++) {
    //     let iThstring = i.toString();
    //     // console.log(iThstring);
    //     if (
    //         iThstring.includes('1') ||
    //         iThstring.includes('2') ||
    //         iThstring.includes('3') ||
    //         iThstring.includes('5') ||
    //         iThstring.includes('6') ||
    //         iThstring.includes('8') ||
    //         iThstring.includes('9') ||
    //         iThstring.includes('0')
    //     ) {
    //         continue;
    //         // console.log(i);
    //         // count++;
    //     } else {
    //         count++;
    //     }
    // }
    // console.log(count);
    let limit = 1000000000;
    let luckydigits = [];
    function generate(curr) {
        if (curr > limit) return;
        // if (curr) {
        luckydigits.push(curr);
        // }
        curr = curr * 10;
        generate(curr + 4);
        generate(curr + 7);
    }
    generate(0);
    delete luckydigits[0];
    luckydigits.sort((a, b) => {
        return a - b;
    });
    // generate(7);
    console.log(luckydigits.indexOf(number));
}


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}

function main() {
    let numberString = readLine();
    let number = parseInt(numberString);
    let n = numberString.length;
    // let result = (2 * (Math.pow(2, n) - 1)) / (2 - 1);
    // if (numberString[n - 1] === '4') {
    //     result = result - 1;
    // }
    let count = 0;
    for (let i = 4; i <= number; i++) {
        let iThstring = i.toString();
        // console.log(iThstring);
        if (
            iThstring.includes('1') ||
            iThstring.includes('2') ||
            iThstring.includes('3') ||
            iThstring.includes('5') ||
            iThstring.includes('6') ||
            iThstring.includes('8') ||
            iThstring.includes('9') ||
            iThstring.includes('0')
        ) {
            continue;
            // console.log(i);
            // count++;
        } else {
            count++;
        }
    }
    console.log(count);
}


    var str = readline().split(' ').map(x=>parseInt(x));
    var L = str[0];
    var P = str[1];
    var N = str[2];
    var F = N>0?true:false;
    for(var i = 1;i<=Math.abs(N);i++){
        if(F){
            P += 1;
            P = P<=L?P:1;
        }else{
            P -= 1;
            P = P>0?P:6;
        }
    }
   print(P);


   function main() {
   var str = stdin[0].split(' ').map(x=>parseInt(x));
    var L = str[0];
    var P = str[1];
    var N = str[2];
    var F = N>0?true:false;
    for(var i = 1;i<=Math.abs(N);i++){
        if(F){
            P += 1;
            P = P<=L?P:1;
        }else{
            P -= 1;
            P = P>0?P:6;
        }
    }
   console.log(P);
}

const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
var stdin = [];
rl.on('line', function (line) {stdin.push(line);});
rl.on('close', main);


'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function checkLuckyNumber(n) {
    let check = 1;
    for (var i = 0; i <= 9; i++) {
        if (String(n).indexOf(i) != -1 && i != 4 && i != 7) {
            check = 0;
            break;
        }
    }
    if (check == 1) return true;
    else return false;
}

function main() {
    let i = parseInt(readLine());
    while (true) {
        if (checkLuckyNumber(i)) {
            let p1 = String(i).split('').map(value => parseInt(value)).filter(value => value == 4)
            let p2 = String(i).split('').map(value => parseInt(value)).filter(value => value == 7)
            if (p1.length == p2.length && p1.length != 0) {
                console.log(i);
                break;
            }
            i++;
        } else i++;
    }
}


const readline = require('readline');

let inputs = [];

// Create readline Interface
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})

// Read Inputs
rl.on('line', lineInput => {
    inputs.push(lineInput)
})

rl.on('close', () => {

    let string = inputs[0];
    let words = [];

    search(string, 0)

    function search(string, start) {

        for (let i = start; i < string.length; i++) {

            let next = string[i + 1] + string[i + 2] + string[i + 3];

            if (string[i] == 'B' && !nextIsWUB(next)) {
                let word = '';

                do {

                    i++;
                    word += string[i];

                } while (!nextIsWUB(string[i + 1] + string[i + 2] + string[i + 3]))

                words.push(word);
                console.log(words)
            }

            if (i <= string.length) {
                return search(string, i + 1)
            }

            return console.log(words)
        }

    }

    // while (!nextIsWUB(next)) {
    //     i++;
    //     word += string[i];
    //     resumeFrom = i + 1;
    // }

    // words.push(word);

    // if (resumeFrom == string.length) {
    //     return console.log(words.join(' '))
    // }

    // return search(string)

    function nextIsWUB(next) {
        return next === "WUB"
    }

})


const readline = require('readline')

let inputs = []

// Create readline Interface
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
})

// Read Inputs
rl.on('line', lineInput => {
  let s = lineInput
  let sentence = []
  let words = []

  for (let i = 0; i < s.length; i++) {
    while (s[i] == 'W' && s[i + 1] == 'U' && s[i + 2] == 'B') {
      i += 3
    }
    let word = s[i]
    while (nextNotWUB(s, i) && i < s.length - 1) {
      i++
      word += s[i]
    }
    words.push(word)
    i += 3
  }

  console.log(words.join(' '))

  function nextNotWUB(s, i) {
    return s[i + 1] != 'W' && s[i + 1] != 'U' && s[i + 2] != 'B'
  }
})

rl.on('close', () => {})


var stdin = process.openStdin();

stdin.addListener("data", function(d) {
    // note:  d is an object, and when converted to a string it will
    // end with a linefeed.  so we (rather crudely) account for that
    // with toString() and then trim()
    d = d.toString().trim();
    var arr = d.split('DUB');
    for( var i = 0; i < arr.length; i++){
        if ( arr[i] === '') {
            arr.splice(i, 1);
            i--;
        }
    }

    console.log(arr.join(' '));

  });


const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.on('line', (input) => {
  let len=input.length;
  let met=false;
  for(let i=0;i<len-1;i++){
      if(input[i]=='/' && input[i+1]!='/')
         rl.write("/");
      else if(input[i]!='/'){
        rl.write(input[i]);
        met=true;
      }

  }

  if(!met || input[len-1]!='/')
          rl.write(input[len-1]);

    rl.close();

});


const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.on('line', (input) => {
    var N = input.length;
    var meet = false;
    for (let i = 0; i < N - 1; i++) {
        if (input[i] == '/' && input[i + 1] != '/')
            rl.write("/");

        else if (input[i] != '/') {
            rl.write(input[i]);
            meet = true;
        }
    }
    if (input[N - 1] != '/' || !meet)
        rl.write(input[N - 1]);

    rl.close();
});


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}

function main() {
  const n = +readLine();

  function countAlmostPrimes(n) {
    const primes = getAllPrimesUpto(n);
    let almostPrimeCount = 0;

    for (let i = 1; i <= n; i++) {
      let count = 0;
      let j = 0;
      while (primes[j] < i && j <= n) {
        if (i % primes[j] === 0) count++;
        if (count >= 2) {
          almostPrimeCount++;
          break;
        }
        j++;
      }
    }
    return almostPrimeCount;
  }

  console.log(countAlmostPrimes(n));
}

function getAllPrimesUpto(n) {
  const primes = [];
  for (let i = 2; i <= n; i++) {
    let isPrime = true;
    for (let j = 2; j <= Math.floor(Math.sqrt(i)); j++) {
      if (i % j === 0) {
        isPrime = false;
        break;
      }
    }
    if (isPrime) primes.push(i);
  }

  return primes;
}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;

const getPrimes = () => {
  const maxN = 25;
  const arr = new Array(maxN + 1).fill(1);
  arr[0] = 0;
  arr[1] = 0;

  for (let i = 2; i*i <= maxN; i++) {
    if (arr[i]) {
      for (let j = i*i; j <= maxN; j += i) {
        arr[j] = 0;
      }
    }
  }

  const primes = [];

  for (let i = 0; i < arr.length; i++) {
    if (arr[i]) {
      primes.push(i);
    }
  }

  return primes;
}

rl.on('line', (d) => {
  const primes = getPrimes();

  let ans = 0;

  for (let i = 6; i <= +d; i++) {
    let primeDivisors = 0;
    for (let p = 0; p < primes.length; p++) {
      if (primes[p] > i) {
        break;
      }

      if (i % primes[p] === 0) {
        primeDivisors++;
      }
    }

    if (primeDivisors === 2) {
      ans++;
    }
  }

  console.log(ans);
  c++;
});


let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    operate(lines);
});

function operate(lines){
     line1=lines[0].split(' ');
    console.log(line1[0]);
    console.log(line1[1]);
}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;

const isVowel = (char) => {
  return ["a", "o", "u", "i", "e"].includes(char);
}

rl.on('line', (str) => {
  let ans = 'YES';

  for (let i = 1; i < str.length; i++) {
    if (!isVowel(str[i]) && !isVowel(str[i - 1]) && str[i - 1] !== 'n') {
      ans = 'NO';
      break;
    }
  }

  console.log(ans);
  c++;
});


var readline = require('readline');
var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

// 자음
var j = [ 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z' ];

// 모음
var m = [ 'a', 'o', 'u', 'i', 'e', 'n' ];

// 반드시 자음 + 모음
// 모음 + (자 or 모), n + (자 or 모)

rl.on('line', function(line) {
	if(!line) {
		process.exit()
  }

  var w = line;
  var v = true;

  for(var i = 0; i < w.length; i++) {
    if(j.indexOf(w[i]) > -1)  {
      // w[i]가 자음
      if(m.indexOf(w[i + 1]) === -1)  {
        v = false;
        break;
      }

      continue;
    }

  }

  console.log(v ? 'YES' : 'NO');
})


//4A
const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
rl.question('', (answer) => {
    rl.close()
  let word = answer.toLowerCase()
  let noVowel = word.replace(/a|e|i|o|u/gi, "")
  let wordArray = noVowel.split("")
  let finishedArray = []
  wordArray.forEach(function(word) {
      finishedArray.push(`.${word}`)
  })
  let finalword = finishedArray.join("")
  console.log(finalword)
});


process.stdin.resume();
process.stdin.setEncoding('utf8');

let inputString = "";
let currentLine = 0;

process.stdin.on('data', (data) => {
    inputString += data;
});

process.stdin.on('end', () => {
    inputString = inputString.trim().split(" ");
    main();
});

function readLine() {
    return inputString[currentLine++];
}

function getChange(string) {
    string = string.toLowerCase();
    resStr = "";
    for(let i=0; i<string.length; i++) {
        if(string.charAt(i) == 'a' || string.charAt(i) == 'e' || string.charAt(i) == 'i' || string.charAt(i) == 'o' || string.charAt(i) == 'u') {
            continue;
        } else {
            resStr += '.' + string.charAt(i);
        }
    }
    return resStr;
}

function main() {
    let string = readLine();
    let resultedString = getChange(string);
    console.log(resultedString);
}


let newString = '';

let transformString = ( character ) => {
    if( !character.match(/[aeiou]/gi) ){
        newString += `.${character}`;
    }
};
process.stdin.once('data', (input) => {
    Array.from( input.toString().trim().toLowerCase() ).map( ( char ) => transformString( char ) );
    console.log(newString);
    process.exit();
});


let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/

    function process(str) {
        str = str.toLowerCase();
        var arr = str.split("");
var value = "i";
  var value2 = "a";
  var value3 = "u";
  var value4 = "o";
  var value5 = "y";
  arr = arr.filter(function(item) {
    return (item !== value && item!== value2 && item!== value3 && item!== value4 && item!== value5);

});

  arr.forEach(function(element,index,array) {
    array[index] = "." + element;
  })

  var newString = arr.join("");
  console.log(newString);

    }

process(lines[0]);

})


let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/

    function process(str) {
        str = str.toLowerCase();
        var arr = str.split("");
var value = "i";
  var value2 = "a";
  var value3 = "u";
  var value4 = "o";
  var value5 = "y";
  arr = arr.filter(function(item) {
    return (item !== value && item!== value2 && item!== value3 && item!== value4 && item!== value5);

});

  arr.forEach(function(element,index,array) {
    array[index] = "." + element;
  })

  var newString = arr.join("");
  console.log(newString);

    }

process(lines);

})


'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
function main() {
    let w = readline();
    let result ="";
    const vow = ["a", "e", "i", "o", "u"];
    for(const letter of w){
        const lowerTerm = letter.toLowerCase();
        if(vow.indexOf(lowerTerm) == -1){
            result += `.${lowerTerm}`;
        }
    }
    console.log(result);
}


const readline = require('readline');

let inputs = [];
const vowels = ['a', 'o', 'e', 'u', 'i'];

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})

rl.on('line', lineInput => {
    inputs.push(lineInput);
    rl.close();
})

rl.on('close', () => {

    let word = inputs[0];

    word = word.split('').filter(char => {
        if (!vowels.includes( char.toLowerCase() ))
            return char
    }).map(char => {
        return `.${char}`
    }).join('').toLowerCase()

    console.log(word)
})


const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

const solution = (input) => {
    const str = input;
    const vowels = ["A", "O", "Y", "E", "U", "I"];
    const vowelsLowerCase = vowels.map((item) => {
        return item.toLowerCase();
    });

    const arr = Array.from(str);

    for(let i = 0; i<arr.length; i++) {
        if(vowels.includes(arr[i]) || vowelsLowerCase.includes(arr[i])) {
            arr.splice(i, 1, '.');
        }
    }

    console.log(arr.join(''));

    rl.close();
}

rl.question('', (input) => {
    solution(input);
});


const { stderr } = require("process");

const readline = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

readline.on("line", (line) => {
  const str = line.split(" ")[0];
  readline.close();
  main(str);
  return;
});

const main = (str) => {
  const string = str.toLowerCase();
  const vowelSet = new Set(["a", "o", "y", "e", "u", "i"]);
  let result = "";
  const stringArr = [...string];

  stringArr.forEach((val, index) => {
    const prevChar = result[result.length - 1];
    if (vowelSet.has(val)) {
      if (!prevChar || (prevChar && prevChar !== ".")) {
        result += ".";
      }
    } else {
      if ((prevChar && prevChar !== ".") || index === 0) {
        result += ".";
      }
      result += val;
    }
  });
};


process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
    _input += input;
});

process.stdin.on("end", function () {
   processData(_input);
});

function processData(input) {
    let vowels = "aeiouy"
    let result = ""
     for(let i=0;i<input.length;i++) {
         if (vowels.indexOf(input[i].toLowerCase()) !== -1) {
             result = result + ""
         } else {
              result = result + "." + input[i].toLowerCase()
         }
     }
     console.log(result)
}


'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const [a, b] = ipt.split(EOL).slice(0, -1)[0].split(' ').map(v => parseInt(v))

  let [x, y] = [0, 0]
  for (let i = 1; i <= a * b; i++) {
    if (!(i % a) && !(i % b)) {
      if (a > b) x++
      else y++
      continue
    }
    if (!(i % a)) x++
    if (!(i % b)) y++
  }

  console.log(x < y ? 'Masha' : x > y ? 'Dasha' : 'Equal')
})


'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const [a, b] = ipt.split(EOL)[0].split(' ').map(v => parseInt(v))

  const da = []
  const db = []

  let [c, d] = [a, b]
  let i = 2
  while (c > 1) {
    while (!(c % i)) {
      c /= i
      da.push(i)
    }
    i++
  }
  i = 2
  while (d > 1) {
    while (!(d % i)) {
      d /= i
      db.push(i)
    }
    i++
  }

  let p = 1
  if (a > b) {
    for (let i = 0; i < db.length; i++) {
      const ioa = da.indexOf(db[i])
      if (~ioa) da.splice(ioa, 1)
    }
    p = a / da.reduce((p, v) => p * v, 1)
    console.log(a - p > b ? 'Masha' : a - p < b ? 'Dasha' : 'Equal')
  } else if (a < b) {
    for (let i = 0; i < da.length; i++) {
      const iob = da.indexOf(db[i])
      if (~iob) db.splice(iob, 1)
    }
    p = b / db.reduce((p, v) => p * v, 1)
    console.log(b - p > a ? 'Dasha' : b - p < a ? 'Masha' : 'Equal')
  }

  // if (a - b > 1) console.log('Masha')
  // else if (b - a > 1) console.log('Dasha')
  // else console.log('Equal')
})


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let n, k;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    [n, k] = d.split(' ').map(Number);
    return;
  }

  const arr = d.split(' ').map(Number);
  let ans = 0;
  let stopIndex = 0;

  for (let i = 0; i < arr.length; i++) {
    if (arr[i] <= k) {
      ans++;
    }
    else {
      stopIndex = i;
      break;
    }
  }

  if (stopIndex !== 0) {
    for (let j = arr.length - 1; j > stopIndex; j--) {
      if (arr[j] <= k) {
        ans++;
      }
      else {
        break;
      }
    }
  }

  console.log(ans);

  c++;
});


const math = require('mathjs')
const readline = require('readline');

let inputs = [];
const mod = 10 ** 7;

// Create readline Interface
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})

// Read Inputs
rl.on('line', inputLine => {
    let seq = [];
    let odds = [];
    let evens = [];
    const num = inputLine.split(' ').map(num => parseInt(num))[0];
    const x = inputLine.split(' ')[1];

    for (let i = 1; i <= num; i++) {
        if (i % 2 == 0)
            evens.push(i)
        else
            odds.push(i)
    }

    seq = [...seq, ...odds, ...evens]
    console.log(seq[parseInt(x - 1)])
})

// Exec
rl.on('close', data => {

})


const readline = require('readline');

let inputs = [];

// Create readline Interface
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

// Read Inputs
rl.on('line', inputLine => {
    let seq = [];
    let odds = [];
    let evens = [];
    const num = inputLine.split(' ').map(num => parseInt(num))[0];
    const x = inputLine.split(' ')[1];

    for (let i = 1; i <= num; i++) {
        if (i % 2 === 0)
            evens.push(i);
        else
            odds.push(i);
    }

    seq = [...seq, ...odds, ...evens];
    console.log(seq[parseInt(x - 1)]);
});


const readline = require('readline');

let inputs = [];

// Create readline Interface
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

// Read Inputs
rl.on('line', inputLine => {
    let seq = [];
    const max = parseInt(inputLine.split(' ')[0]);
    const oddEnd = Math.floor(max / 2)
    const idx = parseInt(inputLine.split(' ')[1]);

    if (idx === 1 && max == 1)
        return console.log(1);

    if (idx <= oddEnd) {
        return console.log(((idx - 1) * 2) + 1)
    } else if (idx > oddEnd && idx <= max) {
        if (max % 2 === 0)
            return console.log((idx - oddEnd) * 2)
        else
            return console.log(((idx - oddEnd) * 2) - 2)
    }

});


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', (d) => {
  const [n, k] = d.split(' ').map(Number);
  let ans = 0;
  let inc = 1;

  for (let i = 1; i <= n; i += 2) {

    if (inc === k) {
      ans = i;
      break;
    }

    inc++;
  }

  if (inc !== k) {
    for (let i = 2; i <= n; i += 2) {
      if (inc === k) {
        ans = i;
        break;
      }
      inc++;
    }
  }

  console.log(ans);
});


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', (d) => {
  let [n, k] = d.split(' ').map(Number);
  let ans = 1;

  while (k > 1) {
    if (ans + 2 <= n) {
      ans += 2;
    }
    else {
      ans = 2;
    }
    k--;
  }

  console.log(ans);
});


const readLine = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
});

const input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  let answer = 0;
  let [n, k] = input[0].split(' ').map(x => parseInt(x));

  if (k >= n) {
    k -= Math.ceil(n/2);
    if (k === 0) console.log(2);
    else console.log(k*2);
  } else {
    console.log(k*2 - 1);
  }
});


let inputString = '';
let currentLine = 0;
process.stdin.on('data', data => {
	inputString += data;
});
process.stdin.on('end', function () {
	inputString = inputString
		.trim()
		.split('\n')
		.map(str => str.trim());
	main();
});

function readLine() {
	return inputString[currentLine++];
}

function multiply(a, b) {
	a = a.toString(10).split('').reverse();
	b = b.toString(10).split('').reverse();

	if (a.length < b.length) {
		[a, b] = [b, a];
	}

	let res = Array(a.length + b.length).fill(0);
	for (let i = 0, lb = b.length; i < lb; ++i) {
		let carry = 0;
		let scarry = 0;
		for (let j = 0, la = a.length; j < la; ++j) {
			let m = b[i] * a[j];
			m += carry;

			if (m > 9) {
				let [c, d] = m.toString(10).split('');
				res[i + j] += (scarry >> 0) + (d >> 0);
				carry = c >> 0;
			} else {
				res[i + j] += (scarry >> 0) + m;
				carry = 0;
			}

			if (res[i + j] > 9) {
				let [c, d] = res[i + j].toString(10).split('');
				res[i + j] = d >> 0;
				scarry = c;
			} else {
				scarry = 0;
			}
		}
		if (carry > 0) res[a.length + i] = carry;
		if (scarry > 0) res[a.length + i] = scarry;
	}

	res.reverse();
	let mulVal = '';
	let flag = false;
	res.forEach(d => {
		if (!flag && d !== 0) flag = true;
		if (flag) mulVal += d;
	});
	return mulVal;
}

function main() {
	let [n, k] = readLine()
		.split(' ')
		.map(x => parseInt(x));
	let s = {};
	let op = Math.ceil(n / 2);
	let x = 1;
	for (let i = 1; i <= n; i++) {
		if ((i & 1) === 1) {
			s[x++] = i;
		} else {
			s[op + x - 1] = i;
		}
	}
	console.log(s[k]);
}


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    let [n, position] = readLine().split(' ').map(Number);
    // let odds = [];
    // let evens = [];
    let result = [];
    for (let i = 1; i <= n; i++) {
        // if (i % 2 === 0) {
        //     evens.push(i);
        // } else {
        //     odds.push(i);
        // }
        if (i % 2 !== 0) {
            result.push(i);
        } else {
            continue;
        }
    }
    for (let i = 1; i <= n; i++) {
        if (i % 2 === 0) {
            result.push(i);
        } else {
            continue;
        }
    }
    // let final = [...odds, ...evens];
    console.log(result[position - 1]);
}


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    //  let [n, position] = //readLine().split(' ').map(Number);
    // let odds = [];
    // let evens = [];
    let result = [];
    for (let i = 1; i <= readLine().split(' ').map(Number)[0]; i++) {
        // if (i % 2 === 0) {
        //     evens.push(i);
        // } else {
        //     odds.push(i);
        // }
        if (i % 2 !== 0) {
            result.push(i);
        } else {
            continue;
        }
    }
    for (let i = 1; i <= n; i++) {
        if (i % 2 === 0) {
            result.push(i);
        } else {
            continue;
        }
    }
    // let final = [...odds, ...evens];
    console.log(result[readLine().split(' ').map(Number)[1] - 1]);
}


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    let [n, position] = readLine().split(' ').map(Number);
    // let odds = [];
    // let evens = [];
    // let result = [];
    // for (let i = 1; i <= n; i++) {
    //     // if (i % 2 === 0) {
    //     //     evens.push(i);
    //     // } else {
    //     //     odds.push(i);
    //     // }
    //     if (i % 2 !== 0) {
    //         result.push(i);
    //     } else {
    //         continue;
    //     }
    // }
    // for (let i = 1; i <= n; i++) {
    //     if (i % 2 === 0) {
    //         result.push(i);
    //     } else {
    //         continue;
    //     }
    // }
    // // let final = [...odds, ...evens]; // [1,3,5,7,9,11,13,2,4,6,8,10,12]
    // console.log(result[position - 1]); [1,3,5,7,2,4,6,8]
    let partition;
    if (n % 2 === 0) {
        partition = n / 2;
    } else {
        partition = n / 2 + 1;
    }
    let final;
    if (position <= partition) {
        final = position * 2 - 1;
    } else {
        final = (position - partition) * 2;
    }
    console.log(final);
}


const readline = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout,
});

const input = [];
readline.on('line', line => input.push(line));

readline.on('close', () => {
    const [n, k] = Array.from(input[0].split(' '), v => parseInt(v));
    if (k <= ((n / 2) + n % 2)) console.log(k * 2 - 1);
    else console.log((k - (n / 2) + n % 2) * 2);
});


process.stdin.resume()
process.stdin.setEncoding('utf8')

let currentLine = 0
let inputString = ''

process.stdin.on('data', chunk => {
    inputString += chunk
})

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(line => {
        return line.trim()
    })
    main()
})

function readLine() {
    return inputString[currentLine++]
}

function main() {
    const [n, m] = readLine().trim().split(' ').map(Number)
    const middle = +(n/2);

    if(n % 2 === 0) {
        if(m <= middle) {
            console.log(m * 2 - 1);
        } else {
            console.log(m * 2 - m);
        }
    } else if(n % 2 !== 0) {
        if(m <= middle) {
            console.log(m * 2 - 1);
        } else {
            console.log((m*2) - (m+1));
        }
    }

}


process.stdin.resume()
process.stdin.setEncoding('utf8')

let currentLine = 0
let inputString = ''

process.stdin.on('data', chunk => {
    inputString += chunk
})

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(line => {
        return line.trim()
    })
    main()
})

function readLine() {
    return inputString[currentLine++]
}

function main() {
    const [n, m] = readLine().trim().split(' ')
    arr = []
    for (let i = 1; i <= n; i++) {
        if (i % 2 !== 0) {
            arr.push(i)
        }
    }
    for (let i = 2; i <= n; i++) {
        if (i % 2 === 0) {
            arr.push(i)
        }
    }
    // console.log(arr)
    console.log(arr[m-1])
}


let fs = require("fs");

let txt = fs.readFileSync(0, "utf-8").split("\r\n").filter(data => {
    return data.length > 0;
});
for (let i = 0; i < txt.length; i++) {
    let info = txt[i].split(" ");
    doit(info[0] * 1, info[1] * 1);
}

function doit(m, a) {
    let odd=[],even=[];
    for (let i = 1; i <= m; i++) {
        if(i%2==1){
            odd.push(i);
        }else{
            even.push(i);
        }

    }
    odd=odd.concat(even);
    console.log(odd[a-1]);

}


let fs=require('fs');

let txt=fs.readFileSync(0,"utf-8").split("\r\n").filter(data=>{return data.length>0});

for (let i = 0; i < txt.length; i++) {
    let info=txt[i].split(" ").filter(data=>{return data.length>0});
}

function doit(n,index){
    if(index<Math.ceil(n/2)){
        console.log(index*2+1);
    }else{
        let r=index-Math.ceil(n/2);
        console.log(r*2+2);
    }
}


let fs=require('fs');

let txt=fs.readFileSync("input.txt","utf-8").split("\r\n").filter(data=>{return data.length>0});

for (let i = 0; i < txt.length; i++) {
    let info=txt[i].split(" ").filter(data=>{return data.length>0});
    doit(info[0]*1,info[1]*1-1);
}

function doit(n,index){
    if(index<Math.ceil(n/2)){
        console.log(index*2+1);
    }else{
        let r=index-Math.ceil(n/2);
        console.log(r*2+2);
    }
}


const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.question('', (numbers) => {
  console.log(doit(numbers.split(' ')));
  rl.close();
});

rl.on("close", () => {
  process.exit(0);
});

const doit = (numbers) => ((+numbers[0] / +numbers[1]) > 1) && ((+numbers[0] / +numbers[2]) > 1) ? "Yes" : "No";


function main() {
    // write code here:
    var arr=stdin[0].split(' '),s;
    s=(arr[0]<arr[1] && arr[0]<arr[2]) ? 'Yes' : 'No';
    console.log(s);
}

const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
var stdin = [];
rl.on('line', function (line) {stdin.push(line);});
rl.on('close', main);


//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  if(one[0] <= tmp[1] && one[0] <= tmp[2]){
  	myout("Yes");
  }else{
  	myout("No");
  }
}


let input = [];

const RL = require('readline').createInterface({
   input : process.stdin,
   output : process.stdout
});

RL.on('line', (line) => {
    input.push(parseInt(line));
});

RL.on('close', () => {
    let {0:n, 1:m, 2:k} = {...input[0].split(' ')};
    n = parseInt(n); m = parseInt(m); k = parseInt(k);

    if(m >= n && k >= n)
        console.log('Yes');
    else
        console.log('No');
});


/**
 * Created by ishanarora on 25/11/18.
 */

const stdin = process.openStdin();
let content = ``;
stdin.addListener('data', d => {
  content += d.toString();
});

stdin.addListener('end', () => {
  content = content.split("\n");
  let content_one = content[0].split(" ");
  let total_cities = parseInt(content_one[0]);
  let a = parseInt(content_one[1]);
  let array = content[1].split(" ");
  console.log(totalCriminalCatch(total_cities, a, array));
});

function totalCriminalCatch(totalCities, a, ti) {

    ti = ti.map(Number);
    let count = 0;

    for (var i = 0; i < 100; i++) {

        let a1 = (a - 1 - i >= 0 && ti[a - 1 - i] > 0) || a - 1 - i < 0;
        let a2 = (a - 1 + i < totalCities && ti[a - 1 + i] > 0) || a - 1 + i > totalCities

        if (a1 && a2) {
            if (i == 0) {
                count += 1;
            } else {

                if ((a - 1 - i >= 0 && ti[a - 1 - i] > 0)) {
                    count++;
                }

                if ((a - 1 + i < totalCities && ti[a - 1 + i] > 0)) {
                    count++;
                }
            }
        }
    }

    return count;
}


let i = ''

process.stdin.on('data',c => {
    i += c
})

process.stdin.on('end', () => {
    const { EOL } = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/

    let citiesCount = parseInt(lines[0].split(" ")[0])
    let limakCity = parseInt(lines[0].split(" ")[1])

    let criminals = lines[1].split(" ").map( value => {
        return parseInt(value)
    })

    let distanceCount = 0
    let caughtCriminalsCount = 0
    for(i = limakCity - 1; i < citiesCount ; i++){
        let leftNumberOfCriminals = 0
        let rightNumberOfCirminals = criminals [ i ]

        if (i - distanceCount > 0) {
            leftNumberOfCriminals = criminals[i - distanceCount]
        }

        if(rightNumberOfCirminals + leftNumberOfCriminals == 2) {
            if (i === limakCity - 1) {
                caughtCriminalsCount++
            } else {
                caughtCriminalsCount = caughtCriminalsCount + 2
            }
        }

        distanceCount++
    }
    console.log(caughtCriminalsCount)
})


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', (d) => {
  let n = +d;

  const soroban = {
    0: 'O-|-OOOO',
    1: 'O-|O-OOO',
    2: 'O-|OO-OO',
    3: 'O-|OOO-O',
    4: 'O-|OOOO-',
    5: '-O|-OOOO',
    6: '-O|O-OOO',
    7: '-O|OO-OO',
    8: '-O|OOO-O',
    9: '-O|OOOO-',
  };

  while (n > 0) {
    const digit = n % 10;
    n = Math.floor(n / 10);

    console.log(soroban[digit]);
  }

});


let data = '';
process.stdin.on('data', c => data += c);
const sol = () => {
    let num = Number(data.split(/\n/g)[0]);
    let result = [];
    while (num > 0) {
        let d = num%10;
        num = Math.trunc(num/10);
        result.push(((d >= 5)?'-O':'O-') +
                '|' +
                ['-OOOO', 'O-OOO', 'OO-OO', 'OOO-O', 'OOOO-'][d%5]);

    }
    console.log(result.join('\n'));
};
process.stdin.on('end', sol);


const readline = require("readline")

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let arrOfShoes
let similarCounter = 0

rl.on("line", (input) => {
    if (!arrOfShoes) {
        arrOfShoes = input.split(" ").map(Number)
    }
    if (arrOfShoes) {
        arrOfShoes.forEach((element1, index1) => {
            arrOfShoes.forEach((element2, index2) => {
                if (element1 === element2 && index1 != index2)
                    similarCounter++
            })
        });
        switch (similarCounter) {
            case 12:
                console.log(12/4)
                rl.close();
                break;
            case 6 :
                console.log(6/3)
                rl.close();
                break;
            case 2 :
                console.log(2/2)
                rl.close();
            default:
                break;
        }
    }
})


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}

function main() {
    let shoesArray = readLine().split(' ').map(Number);
    let selecTed = [];
    for (let i = 0; i < shoesArray.length; i++) {
        if (selecTed.indexOf(shoesArray[i] === -1)) {
            selecTed.push(shoesArray[i]);
        }
    }
    let result = shoesArray.length - selecTed.length;
    console.log(result);
}


const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let cups = []
let medals = []

rl.on('line', (input) => {
    if (l === 0) {
        cups = input.split(' ').map(function (item) {
            return parseInt(item, 10);
        });
    } else if (l === 1) {
        medals = input.split(' ').map(function (item) {
            return parseInt(item, 10);
        });
    } else {
        function add(a, b) {
            return a + b;
        }
        rl.close();
        let shelfs = parseInt(input)
        var cupsSum = cups.reduce(add, 0);
        var medalsSum = medals.reduce(add, 0);
        shelfs-=cupsSum/5
        shelfs-=medalsSum/10
        if(shelfs>=0){
            console.log("YES")
            return 0
        }
        console.log("NO")

        return 0;
    }
    l++
});


const readline = require("readline")

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let pointToCompare;
let dot_prob;

rl.on("line", (input) => {
    if (!pointToCompare) {
        let temparr = input.split(" ").map(Number)
        if (temparr[0] > temparr[1])
            pointToCompare = temparr[0]
        else pointToCompare = temparr[1]
    }
    if (pointToCompare) {
        dot_prob = (6 - pointToCompare + 1)

        let gcdd = gcd(dot_prob, 6)
        console.log(dot_prob / gcdd, "/", 6/gcdd)
        rl.close();
    }
})

var gcd = function (a, b) {
    if (!b) return a;

    return gcd(b, a % b);
};


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', (d) => {
  let [y, w] = d.split(' ').map(Number);
  let start = Math.max(y, w);
  let count = 0;

  for (let i = start; i <= 6; i++) {
    count++;
  }

  if (count === 1) {
    console.log('0/1');
  }
  else if (count === 6) {
    console.log('1/1');
  }
  else {
    if (count % 2 === 0) {
      console.log(`${count / 2}/3`);
    }
    else if (count % 3 === 0) {
      console.log(`${count / 3}/2`);
    }
    else {
      console.log(`${count}/6`);
    }
  }
});


var fs=require("fs");

var data=fs.readFileSync('data');
var[n,m,a]=data.toString().split(' ');
console.log(Math.ceil(n/a)*Math.ceil(m/a));


const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.on('line', (input) => {

   // console.log(`Received: ${input}`);

   var temp = input.split(' ');
   var m = parseInt(temp[0]);
   var n = parseInt(temp[1]);
   var a = parseInt(temp[2]);

   var x = parseInt(m/a) + !!(m%a);
   var y = parseInt(n/a) + !!(n%a);
   console.log(x+y);
   rl.close();
  });


let fs = require('fs')

let txt = fs.readFileSync("input.txt", "utf-8").split("\r\n").filter((data)=>{
    return data.length>0;
});

txt.forEach(data1 => {
    let data = data1.split(" ");
    square(data[0] * 1, data[1] * 1, data[2] * 1)
})

function square(a, b, c) {
    console.log(Math.ceil(a / c) + Math.ceil(b / c));
}


const rl = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.on('line', (line) => {
    const [n, m, a] = line.split(' ').map(i => parseInt(i));

    let x;
    if (a >= n) {
        x = a;
    } else {
        x = Math.floor(n / a) + (n % a ? 1 : 0);
    }

    let y;
    if (a >= m) {
        y = a;
    } else {
        y = Math.floor(m / a) + (m % a ? 1 : 0);
    }

    console.log(x * y);
});


// Get process.stdin as the standard input object.
var standard_input = process.stdin;

// Set input character encoding.
standard_input.setEncoding('utf-8');

// Prompt user to input data in console.

// When user input data and click enter key.
standard_input.on('data', function (data) {

    // User input exit.
    if(data === 'exit\n'){
        // Program exit.
        console.log("User input complete, program exit.");
        process.exit();
    }else
    {
		//variable: data
		var url = "https://oeis.org/search?fmt=json&q=id:" + data;
		console.log(url);
		    }
});


// Get process.stdin as the standard input object.
const https = require("https");
var standard_input = process.stdin;

// Set input character encoding.
standard_input.setEncoding('utf-8');

// Prompt user to input data in console.

// When user input data and click enter key.
standard_input.on('data', function (data) {

    // User input exit.
    if(data === 'exit\n'){
        // Program exit.
        console.log("User input complete, program exit.");
        process.exit();
    }else{
		var r = int(data[6])
		console.log(r % 2);
	}
});


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let t = +readLine();
  while (t--) {
    const num = +readLine();
    if (num % 2 === 0) {
      const [a, b] = [num / 2, num / 2];
      console.log(`${a} ${b}`);
    } else {
      let n = (num + 1) / 2;
      for (let i = n; i <= num; i++) {
        const [b, a] = [i, num - i];
        if (b % a === 0) {
          console.log(`${a} ${b}`);
          break;
        }
      }
    }
  }
}


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let t = +readLine();
  while (t--) {
    const num = +readLine();
    let found = false;
    if (num % 2 === 0) {
      console.log(`${num / 2} ${num / 2}`);
      continue;
    } else {
      for (let i = 2; i * i <= num; i++) {
        if (num % i === 0) {
          let [a, b] = [num / i, num - num / i];
          console.log(`${a} ${b}`);
          found = true;
          break;
        }
      }
    }
    !found && console.log(`${1} ${num}`);
  }
}


// node template.js < A-small.in > A-small.out

function main() {
    var tests = 1;
    tests = nextInt();

    for (let t = 1; t <= tests; t++) {
        let N = nextInt();

        let result = -1;
        for(let i = 2; i*i <= N; i++) {
            if (N % i === 0) {
                result = i;
                break;
            }
        }
        let b = (result-1)*(N/result);
        let a = N-b;

        print(a + " " + b);
    }
}

// ------- Template ------------------
function newTensor(dimensions, value) {
    let res = [];
    let dim = dimensions[0], subdim = dimensions.slice(1);
    if (subdim.length == 0) {
        for(let i = 0; i < dim; i++) {
            res.push(value);
        }
    } else {
        for(let i = 0; i < dim; i++) {
            res.push(newTensor(subdim, value));
        }
    }
    return res;
}

if (!String.prototype.startsWith) {
    Object.defineProperty(String.prototype, 'startsWith', {
        value: function(search, rawPos) {
            var pos = rawPos > 0 ? rawPos|0 : 0;
            return this.substring(pos, pos + search.length) === search;
        }
    });
}
if (!String.prototype.endsWith) {
    String.prototype.endsWith = function(search, this_len) {
        if (this_len === undefined || this_len > this.length) {
            this_len = this.length;
        }
        return this.substring(this_len - search.length, this_len) === search;
    };
}

var curTokens = [], curToken = 0;

function next() {
    while (curToken >= curTokens.length) {
        curTokens = readline().split(/[\s]+/);
        curToken = 0;
    }
    return curTokens[curToken++];
}

function nextInt() {
    return parseInt(next());
}

// code for nodejs
var inputBuffer = '', curLine = 0;

function readline() {
    return inputBuffer[curLine++];
}

function print(data) {
    process.stdout.write(data + '\n');
}

process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
    inputBuffer += chunk;
});

process.stdin.on('end', function () {
    inputBuffer = inputBuffer.split(/[\s]+/);
    main();
});


process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    B();
});

function readline() {
    return inputString[currentLine++];
}

function pi(a) {
    return parseInt(a);
}

function ti(a){
    for(let i = 0; i < a.length; i++)
        a[i] = pi(a[i]);

    return a;
}

function A(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let n = pi(readline());
        let ans = '';
        for(let i = 0; i < n; i++){
            ans += '1 ';
        }
        console.log(ans);
    }
}

function B(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let n = pi(readline());

        if(n%2===0){
            console.log(n/2, n/2);
            continue;
        }

        let sq = Math.floor(Math.sqrt(n));
        let min = 9999999999999;
        let minPair = [];
        for(let i = 1; i <= sq; i++){
            if(n % i === 0){
                let x = n/i;
                let b = (x-1)*i;
                if(i+b === n){
                    if(min > b){
                        min = b;
                        minPair = [i,b];
                    }
                }
            }
        }
        console.log(minPair[0], minPair[1]);
    }
}


process.stdin.setEncoding('utf8');
let input = [];
process.stdin.on('readable', () => {
    const chunk = process.stdin.read();
    if (chunk !== null) {
        let re = /\n| /;
        input = chunk.split(re).slice(0, -1);
        let myinput = input.map(value => parseInt(value));
        console.log(snowball.apply(null, myinput));
        process.exit(0);
    }
});

function snowball(weight, height, u1, d1, u2, d2) {
    let w = weight, h = height;
    for (; h >= 0; h--) {
        w += h;
        if (h == d1) w = w - u1 ? w - u1 : 0;
        if (h == d2) w = w - u2 ? w - u2 : 0;
    }
    return w;
}


process.stdin.setEncoding('utf8');
let input = [];
process.stdin.on('readable', () => {
    const chunk = process.stdin.read();
    if (chunk !== null) {
        let re = /\n\s*| /;
        input = chunk.split(re).slice(0, -1);
        let myinput = input.map(value => parseInt(value));
        console.log(snowball.apply(null, myinput));
        process.exit(0);
    }
});

function snowball(weight, height, u1, d1, u2, d2) {
    let w = weight, h = height;
    for (; h >= 0; h--) {
        w += h;
        if (h == d1) w -= u1;
        if (h == d2) w -= u2;
        if (!w) w = 0;
    }
    return w;
}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let w, h;
let u1, u2, d1, d2;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    [w, h] = d.split(' ').map(Number);
    return;
  }

  if (c === 1) {
    c++;
    [u1, d1] = d.split(' ').map(Number);
    return;
  }

  [u2, d2] = d.split(' ').map(Number);

  c++;
});

rl.on('close', () => {
  let ans = w;

  ans += h*(h+1) / 2;
  ans -= u1;
  ans -= u2;
  ans = Math.max(0, ans);

  console.log(ans);
});


const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let w = []
let h = []

rl.on('line', (input) => {
    if (l === 0) {
        let inp = input.split(" ").map(x => parseInt(x))
        w.push(inp[0])
        h.push(inp[1])
    } else if (l === 1) {
        let inp = input.split(" ").map(x => parseInt(x))
        w.push(inp[0])
        h.push(inp[1])
    } else {
        rl.close();
        let inp = input.split(" ").map(x => parseInt(x))
        let wg = w[0]
        let hg = h[0]
        w.push(inp[0])
        h.push(inp[1])
        if (h[1] > h[2]) {
            for (let i = h[0]; i >= h[1]; i--) {
                wg += i
                hg--
            }
            wg -= w[1]
            if (wg < 0)
                wg = 0
            if (hg <= 0) {
                console.log(wg)
                return
            }
            for (let i = h[1] - 1; i >= h[2]; i--) {
                wg += i
                hg--
            }
            wg -= w[2]
            if (wg < 0)
                wg = 0

            if (hg > 0)
                wg += hg
            console.log(wg)
        } else {
            for (let i = h[0]; i >= h[2]; i--) {
                wg += i
                hg--
            }
            wg -= w[2]
            if (wg < 0)
                wg = 0
            if (hg <= 0) {
                console.log(wg)
                return
            }
            for (let i = h[2] - 1; i >= h[1]; i--) {
                wg += i
                hg--
            }
            wg -= w[1]
            if (wg < 0)
                wg = 0
            if (hg > 0)
                wg += hg
            console.log(wg)
        }
    }
    l++
});


//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
	};
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var N = nextInt();
	var max = 0;
	var maxIndex = {
		x : 0,
		y : 0
	}
	for(var i = 1; i < N; i++){
		var x = i;
		var y = N - i;
		if(x < y && max < (x / y)){
			max = x / y;
			maxIndex.x = x;
			maxIndex.y = y;
		}
	}
	myout(maxIndex.x + " " + maxIndex.y);
}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', (d) => {
  const n = +d;

  if (n % 2 === 1) {
    console.log(Math.floor(n / 2), Math.ceil(n / 2));
  }
  else {
    const mid = n / 2;
    console.log(mid - 1, mid + 1);
  }
});


function processData(input) {
    //Enter your code here
     let  res=input.split("\n"),   n=+(res[0]),
      arr=res[1].split("").filter((x)=>x!==""),
       cnt=dvsr(n);
       //console.log(cnt,arr)
  cnt.forEach((d)=>{
    let temp="";
    while(d>0){
      temp+=arr.shift();
      d--
    }
    //console.log(arr,temp)
    temp=[...temp].reverse();
    arr=[...temp,...arr];

  })
  console.log(arr.reverse().join(""))
}

process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
    _input += input;
});

process.stdin.on("end", function () {
   processData(_input);
});
function dvsr(n){
  let v=Math.sqrt(n),cnt=[]
for(let i=2;i<=v;i++){
  if(n%i===0){
      cnt.push(i);
      cnt.push(n/i)
  }
   // cnt.push(i)
}
return cnt.sort((a,b)=>a-b)
}


let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) !== undefined) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) !== undefined) return res;
    }
  }
}

function Arr(a, b, fn, prev) {
  let p = prev || 0;
  if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);
  return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/); r = 0;
  let [n, k, s, t] = inp;
  n = +n;
  k = +k;
  let count = s => Arr(0, n - 2, i => Arr(i + 1, n - 1, j => s[i] == t[0] && s[j] == t[1]).sum()).sum();
  let max = count(s);
  For(0, k, i => {
    let s0 = [...s];
    let remain = i;
    For(0, n - 1, j => {
      if (remain <= 0) return 1;
      if (s0[j] != t[0]) {
        s0[j] = t[0];
        remain--;
      }
    });
    remain = k - i;
    For(n -1, 0, j => {
      if (remain <= 0) return 1;
      if (s0[j] != t[1]) {
        s0[j] = t[1];
        remain--;
      }
    })
    max = Math.max(max, count(s0));
  });
  console.log(max);
})();


let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) !== undefined) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) !== undefined) return res;
    }
  }
}

function Arr(a, b, fn, prev) {
  let p = prev || 0;
  if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);
  return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/); r = 0;
  let [n, k, s, t] = inp;
  n = +n;
  k = +k;
  if (t[0] == t[1]) {
    let x = Math.min([...s].filter(c => c == t[0]).length + k, n);
    console.log(x * (x - 1) / 2);
    return;
  }
  let t0 = Arr(0, n - 1, (i, p) => p + (s[i] == t[0]));
  let t1 = Arr(0, n - 1, (i, p) => p + (s[n - 1 - i] == t[1])).reverse();
  let max = Arr(0, n - 2, i => s[i] == t[0] ? t1[i + 1] : 0).sum();

  For(0, Math.min(k, n - t0[n - 1] - t1[0]), i => {
    let ss = [...s];
    let remain = i;
    For(0, n - 1, i => {
      if (remain <= 0) return 0;
      if (ss[i] != t[0] && ss[i] != t[1]) { ss[i] = t[0]; remain-- }
    })
    For(0, Math.min(k - i, t1[0]), j => {
      let s0 = [...ss];
      let remain = j;
      For(0, n - 1, i => {
        if (remain <= 0) return 0;
        if (s0[i] == t[1]) { s0[i] = t[0]; remain-- }
      })

      For(0, Math.min(k - i - j, n - t0[n - 1] - t1[0]), z => {
        let s1 = [...s0];
        let remain = z;
        For(n - 1, 0, i => {
          if (remain <= 0) return 0;
          if (s1[i] != t[1] && s1[i] != t[0]) { s1[i] = t[1]; remain-- }
        });
        remain = k - i - j - z;
        For(n - 1, 0, i => {
          if (remain <= 0) return 0;
          if (s1[i] == t[0]) { s1[i] = t[1]; remain-- }
        });
        let tt = Arr(0, n - 1, (i, p) => p + (s1[i] == t[0]));
        max = Math.max(max, Arr(1, n - 1, i => s1[i] == t[1] ? tt[i - 1] : 0).sum())
      })

      // console.log(i, j, s0.join(''));
      // remain = k - i - j;
      // let t00 = Arr(0, n - 1, (i, p) => p + (s0[i] == t[0]));
      // let j1 = n - 1;
      // let j2 = n - 1;
      // let sum2 = 0;
      // while (remain > 0 && (j1 >= 0 || j2 >= 0)) {
      //   while (j1 >= 0 && (s0[j1] == t[0] || s0[j1] == t[1])) j1--;
      //   while (j2 >= 0 && s0[j2] != t[0]) {
      //     if (s0[j2] == t[1]) sum2++;
      //     j2--;
      //   }
      //   if ((t00[j1 - 1] || 0) > (t00[j2 - 1] || 0) - sum2) {
      //     s0[j1--] = t[1];
      //     remain--;
      //   } else if ((t00[j2 - 1] || 0) - sum2 >= 0) {
      //     s0[j2--] = t[1];
      //     sum2++;
      //     remain--;
      //   } else break;
      // }
      // t00 = Arr(0, n - 1, (i, p) => p + (s0[i] == t[0]));
      // // console.log(i, j, k - i - j, s0.join(''), Arr(1, n - 1, i => s0[i] == t[1] ? t00[i - 1] : 0).sum());
      // max = Math.max(max, Arr(1, n - 1, i => s0[i] == t[1] ? t00[i - 1] : 0).sum())
    })
  })
  console.log(max);
})();


'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function main() {

    let number = readline();
    var res= number.replaceAll("144","").replaceAll("14","").replaceAll("1","");
    if(res.length > 0)
    {
        console.log("NO");
    }
    else{
        console.log("YES");
    }
}

String.prototype.replaceAll = function(search, replacement) {
    var target = this;
    return target.split(search).join(replacement);
};


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    let numberString = readLine();
    if (numberString.indexOf('4') === -1 && numberString.indexOf('1') === -1) {
        console.log('NO');
        return;
    }
    if (numberString[0] !== '1') {
        console.log('NO');
        return;
    }
    if (numberString.includes('444')) {
        console.log('NO');
        return;
    }
    console.log('YES');
}


let data = '';
process.stdin.on('data', c => data += c);

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	let s = nl.line();
	let flag = s.split('1').every(x => x.length < 3 && (x.length == 0 || x == '4' || x == '44'));
	console.log(flag?'YES':'NO');

};

process.stdin.on('end', sol);


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;

rl.on('line', (d) => {
  const [n, m] = d.split(' ').map(Number);
  let ans = m;
  let iter = 1;

  while (ans > iter) {
    ans -= iter;
    iter++;

    if (iter > n) {
      iter = 1;
    }

    if (iter === 1 && ans === 1) {
      ans = 0;
    }
  }

  console.log(ans);

  c++;
});


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

const isPrime = (n) => {
  let ans = true;

  for (let i = 2; i*i <= n; i++) {
    if (n % i === 0) {
      return false;
    }
  }

  return ans;
}

rl.on('line', (d) => {
  const [n, m] = d.split(' ').map(Number);
  let ans = 'NO';

  for (let i = n + 1; i <= m; i++) {
    if (isPrime(i) && i === m) {
      ans = 'YES';
      break;
    }
  }

  console.log(ans);
});


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    let nums = readLine().split(' ').map(Number);
    let [n, m] = nums;

    for (let j = n + 1; j <= m; j++) {
        if (isPrime(j) && j === m) {
            console.log('YES');
            return;
        }
    }
    console.log('NO');
}

function isPrime(number) {
    if (number <= 1) {
        return;
    }
    for (let i = 2; i < number; i++) {
        if (number % i === 0) {
            return false;
        }
    }
    return true;
}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', (d) => {
  const [n, m] = d.split(' ').map(Number);
  let ans = 0;
  ans += n;
  let add = Math.floor(n / m);
  ans += add;
  let secondAdd = Math.floor(ans / m);

  if (add !== secondAdd) {
    ans += secondAdd - add;
  }

  console.log(ans);
});


const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.on("line", (line) => {
  let n = "";
  let m = "";
  [n, m] = line;
  for (let index = 1; index <= n; index++) if (index % m == 0) n++;
  console.log(n);
});
rl.on("close", () => {});


let inputString = '';
let currentLine = 0;
process.stdin.on('data', data => {
	inputString += data;
});
process.stdin.on('end', function () {
	inputString = inputString
		.trim()
		.split('\n')
		.map(str => str.trim());
	main();
});

function readLine() {
	return inputString[currentLine++];
}

function multiply(a, b) {
	a = a.toString(10).split('').reverse();
	b = b.toString(10).split('').reverse();

	if (a.length < b.length) {
		[a, b] = [b, a];
	}

	let res = Array(a.length + b.length).fill(0);
	for (let i = 0, lb = b.length; i < lb; ++i) {
		let carry = 0;
		let scarry = 0;
		for (let j = 0, la = a.length; j < la; ++j) {
			let m = b[i] * a[j];
			m += carry;

			if (m > 9) {
				let [c, d] = m.toString(10).split('');
				res[i + j] += (scarry >> 0) + (d >> 0);
				carry = c >> 0;
			} else {
				res[i + j] += (scarry >> 0) + m;
				carry = 0;
			}

			if (res[i + j] > 9) {
				let [c, d] = res[i + j].toString(10).split('');
				res[i + j] = d >> 0;
				scarry = c;
			} else {
				scarry = 0;
			}
		}
		if (carry > 0) res[a.length + i] = carry;
		if (scarry > 0) res[a.length + i] = scarry;
	}

	res.reverse();
	let mulVal = '';
	let flag = false;
	res.forEach(d => {
		if (!flag && d !== 0) flag = true;
		if (flag) mulVal += d;
	});
	return mulVal;
}

function main() {
	let [n, m] = readLine()
		.split(' ')
		.map(x => x >> 0);
	let q = readLine()
		.split(' ')
		.map(x => x >> 0);
	q = q.map(x => (x <= m ? 0 : Math.floor(x / m)));

	let max = 0,
		v = 0;
	for (let i = 0; i < n; ++i) {
		if (q[i] >= max) {
			max = q[i];
			v = i + 1;
		}
	}
	console.log(v);
}


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    let [Numberofstudents, initialCandyValue] = readLine()
        .split(' ')
        .map(Number);
    // let home = [];
    // let more = [];

    let students = readLine().split(' ').map(Number); // [1 3 1 4 2]
    // for (let i = 0; i < students.length; i++) {
    //     if (students[i] <= initialCandyValue) {
    //         let t = students[i];
    //         home[t] = i;
    //     } else {
    //         let test = students[i];
    //         more[test] = i;
    //     }
    // }
    // let highest = 0;
    // let vagfol = 0;
    // if (more.length !== 0) {
    //     for (let i = 0; i < more.length; i++) {
    //         // if (more[i] > highest) {
    //         //     highest = more[i];
    //         // }
    //         let iThVagfol = Math.ceil(more[i] / initialCandyValue);
    //         if (iThVagfol > vagfol) {
    //             vagfol = iThVagfol;
    //         } else if (vagfol === iThVagfol) {
    //             highest = more[i];
    //         }
    //     }
    // } else if (more.length === 0) {
    //     for (let i = 0; i < home.length; i++) {
    //         if (home[i] > highest) {
    //             highest = home[i];
    //         }
    //     }
    // }

    let highest = 0;
    let vagfol = 0;
    // if (more.length !== 0) {
    for (let i = 0; i < students.length; i++) {
        // if (more[i] > highest) {
        //     highest = more[i];
        // }
        let iThVagfol = Math.ceil(students[i] / initialCandyValue);
        if (iThVagfol > vagfol) {
            vagfol = iThVagfol;
        } else if (vagfol === iThVagfol) {
            highest = students.lastIndexOf(students[i]);
        }
    }
    console.log(highest + 1);
    // console.log(Math.max.apply(null, more));
}


process.stdin.resume();
process.stdin.setEncoding("utf8");

let s = "";

process.stdin.on("data", function(chunk) {
  s += chunk;
});

process.stdin.on("end", function() {
  console.log(solve(s));
});

function solve(s) {
  const [x, y, z] = s.split(" ").map(Number);

  if (x - y == z) {
    return '0';
  }
  if (Math.abs(x - y) < z) {
    return '?';
  }
  if (x - y > 0) {
    return '+';
  }
  if (x - y < 0) {
    return '-';
  }
}


let data = '';
process.stdin.on('data', c => data += c);
const solution = () => {
	let line = data.split('\n');
	let n = parseInt(line[0], 10);
	let a = line[1].replace("RU","D").replace("UR","D");
	console.log(a.length);

};

process.stdin.on('end', solution);