The Two-dimensional kingdom is going through hard times... This morning the Three-Dimensional kingdom declared war on the Two-dimensional one. This (possibly armed) conflict will determine the ultimate owner of the straight line.The Two-dimensional kingdom has a regular army of n people. Each soldier registered himself and indicated the desired size of the bulletproof vest: the i-th soldier indicated size ai. The soldiers are known to be unpretentious, so the command staff assumes that the soldiers are comfortable in any vests with sizes from ai - x to ai + y, inclusive (numbers x, y ≥ 0 are specified). The Two-dimensional kingdom has m vests at its disposal, the j-th vest's size equals bj. Help mobilize the Two-dimensional kingdom's army: equip with vests as many soldiers as possible. Each vest can be used only once. The i-th soldier can put on the j-th vest, if ai - x ≤ bj ≤ ai + y.

The first input line contains four integers n, m, x and y (1 ≤ n, m ≤ 105, 0 ≤ x, y ≤ 109) — the number of soldiers, the number of vests and two numbers that specify the soldiers' unpretentiousness, correspondingly. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) in non-decreasing order, separated by single spaces — the desired sizes of vests.  The third line contains m integers b1, b2, ..., bm (1 ≤ bj ≤ 109) in non-decreasing order, separated by single spaces — the sizes of the available vests.

In the first line print a single integer k — the maximum number of soldiers equipped with bulletproof vests.  In the next k lines print k pairs, one pair per line, as "ui vi" (without the quotes). Pair (ui, vi) means that soldier number ui must wear vest number vi. Soldiers and vests are numbered starting from one in the order in which they are specified in the input. All numbers of soldiers in the pairs should be pairwise different, all numbers of vests in the pairs also should be pairwise different. You can print the pairs in any order. If there are multiple optimal answers, you are allowed to print any of them.

NoteIn the first sample you need the vests' sizes to match perfectly: the first soldier gets the first vest (size 1), the third soldier gets the second vest (size 3). This sample allows another answer, which gives the second vest to the fourth soldier instead of the third one.In the second sample the vest size can differ from the desired size by at most 2 sizes, so all soldiers can be equipped.

var nmxy = readline().split(' ').map(Number);
var n = nmxy[0];
var m = nmxy[1];
var x = nmxy[2];
var y = nmxy[3];
var a = readline().split(' ').map(Number);
var b = readline().split(' ').map(Number);
var ans = [];
var i = 0;
var j = 0;
while (i<n){
    while (j<m){
		if (a[i]-x <= b[j] && b[j] <= a[i]+y) {
			ans.push(i+1, j+1);
			j++;
			break;
		}
		else if (b[j] < a[i]-x) j++;
		else if (b[j] > a[i]+y) break;
	}
	i++;
}
print (ans.length/2);
for (var k=0; k<ans.length; k=k+2){
	print (ans[k], ans[k+1]);
}

'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++];
}

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const input = readline().split(' ').map(Number)
  const [people, vests, reduction, increase] = input
  const desiredSizes = readline().split(' ').map(Number)
  const availableSizes = readline().split(' ').map(Number)

  helper(desiredSizes, availableSizes, parseInt(reduction), parseInt(increase))
}

function helper(desiredSizes, availableSizes, reduction, increase) {
    let result = []
    let currentSizeIndex = 0
    let count = 0
    let pairs = ''

    for (let i = 0; i < desiredSizes.length; i++) {
        let min = desiredSizes[i] - reduction
        let max = desiredSizes[i] + increase

        while (currentSizeIndex < availableSizes.length) {
            if (availableSizes[currentSizeIndex] > max) {
                break;
            }

            if (availableSizes[currentSizeIndex] >= min) {
                count++;
                pairs += `\n${i + 1} ${currentSizeIndex + 1}`;
                currentSizeIndex++;
                break;
            }
            currentSizeIndex++;
        }

        if (currentSizeIndex === availableSizes.length) break;
    }

    console.log(`${count}${pairs}`);
}

'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++];
}

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const input = readline().split(' ')
  const [people, vests, reduction, increase] = input
  const desiredSizes = readline().split(' ').map(size => parseInt(size))
  const availableSizes = readline().split(' ').map(size => parseInt(size))

  helper(desiredSizes, availableSizes, parseInt(reduction), parseInt(increase))
}

function helper(desiredSizes, availableSizes, reduction, increase) {
    let result = []
    let currentSizeIndex = 0
    let count = 0
    let pairs = ''

    for (let i = 0; i < desiredSizes.length; i++) {
        let min = desiredSizes[i] - reduction
        let max = desiredSizes[i] + increase

        while (currentSizeIndex < availableSizes.length) {
            if (availableSizes[currentSizeIndex] > max) {
                break;
            }

            if (availableSizes[currentSizeIndex] >= min) {
                count++;
                pairs += `\n${i + 1} ${currentSizeIndex + 1}`;
                currentSizeIndex++;
                break;
            }
            currentSizeIndex++;
        }

        if (currentSizeIndex === availableSizes.length) break;
    }

    console.log(`${count}${pairs}`);
}

'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 printResult(x) {
    process.stdout.write(x);
}

function main() {
    const nmxy = readLine().split(' ').map(Number);
    const a = readLine().split(' ').map(Number);
    const b = readLine().split(' ').map(Number);

    const result = dressEmInVests(nmxy, a, b);
    printResult(result);
}

const dressEmInVests = (nmxy, a, b) => {
    let j = 0;
    let n = nmxy[0];
    let m = nmxy[1];
    let x = nmxy[2];
    let y = nmxy[3];
    let count = 0;
    let pairs = '';

    for (let i = 0; i < n; i++) {
        let min = a[i] - x;
        let max = a[i] + y;
        // console.log(i, a[i], min, max, j, b[j])
        while (j < m) {
            if (b[j] > max) {
                break;
            }
            if (b[j] >= min) {
                count++;
                pairs += `\n${i + 1} ${j + 1}`;
                j++;
                break;
            }
            j++;
        }
        if (j === m) break;
    }

    return `${count}${pairs}`;
};

var nmxy = readline().split(' ').map(Number);
var n = nmxy[0];
var m = nmxy[1];
var x = nmxy[2];
var y = nmxy[3];
var a = readline().split(' ').map(Number);
var b = readline().split(' ').map(Number);
var ans = [];
var i = 0;
var j = 0;
while (i<n){
    while (j<m){
		if (a[i]-x <= b[j] && b[j] <= a[i]+y) {
			ans.push(i+1, j+1);
			j++;
			break;
		}
		else break;
	}
	i++;
}
print (ans.length/2);
for (var k=0; k<ans.length; k=k+2){
	print (ans[k], ans[k+1]);
}

var nmxy = readline().split(' ').map(Number);
var n = nmxy[0];
var m = nmxy[1];
var x = nmxy[2];
var y = nmxy[3];
var a = readline().split(' ').map(Number);
var b = readline().split(' ').map(Number);
var ans = '';
var metka = 0;
next: for (var i=0; i<n; i++){
    for (var j=metka; j<m; j++){
		if (a[i]-x <= b[j] && b[j] <= a[i]+y) {
			ans = ans + (i+1) + (j+1);
			metka = j+1;
			continue next;
		}
	}
}
print (ans.length/2);
for (var k=0; k<ans.length; k=k+2){
	print (ans[k], ans[k+1]);
}

'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++];
}

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const input = readline().split(' ')
  const [people, vests, reduction, increase] = input
  const desiredSizes = readline().split(' ').map(size => parseInt(size))
  const availableSizes = readline().split(' ').map(size => parseInt(size))

  helper(desiredSizes, availableSizes, reduction, increase)
}

function helper(desiredSizes, availableSizes, reduction, increase) {
    let result = []
    let currentSizeIndex = 0
    for (let i = 0; i < desiredSizes.length; i++) {
        if (availableSizes[currentSizeIndex] >= desiredSizes[i] - reduction && availableSizes[currentSizeIndex] <= desiredSizes[i] + increase) {
            result.push([i + 1, currentSizeIndex + 1])
            currentSizeIndex++
        }
    }

    console.log(result.length)
    result.forEach(r => console.log(r.join(' ')))
}

'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++];
}

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const input = readline().split(' ')
  const [people, vests, reduction, increase] = input
  const desiredSizes = readline().split(' ').map(size => parseInt(size))
  const availableSizes = readline().split(' ').map(size => parseInt(size))

  helper(desiredSizes, availableSizes, parseInt(reduction), parseInt(increase))
}

function helper(desiredSizes, availableSizes, reduction, increase) {
    let result = []
    let currentSizeIndex = 0
    for (let i = 0; i < desiredSizes.length; i++) {
        if (availableSizes[currentSizeIndex] >= desiredSizes[i] - reduction && availableSizes[currentSizeIndex] <= desiredSizes[i] + increase) {
            result.push([i + 1, currentSizeIndex + 1])
            currentSizeIndex++
        }
    }

    console.log(result.length)
    result.forEach(r => console.log(r.join(' ')))
}

'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++];
}

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const input = readline().split(' ')
  const [people, vests, reduction, increase] = input
  const desiredSizes = readline().split(' ').map(size => parseInt(size))
  const availableSizes = readline().split(' ').map(size => parseInt(size))

  helper(desiredSizes, availableSizes, parseInt(reduction), parseInt(increase))
}

function helper(desiredSizes, availableSizes, reduction, increase) {
    let result = []
    let currentSizeIndex = 0
    let count = 0
    let pairs = ''

    for (let i = 0; i < desiredSizes.length; i++) {
        let min = desiredSizes[i] - reduction
        let max = desiredSizes[i] + increase

        while (currentSizeIndex < availableSizes.length) {
            if (availableSizes[currentSizeIndex] > max) {
                break
            }

            if (availableSizes[currentSizeIndex] >= min) {
                count++;
                pairs += `\n${i + 1} ${currentSizeIndex + 1}`;
                currentSizeIndex++;
                break;
            }
            currentSizeIndex++;
        }

        if (currentSizeIndex === availableSizes.length) break;
    }

    return `${count}${pairs}`;
}

'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++];
}

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const input = readline().split(' ')
  const [people, vests, reduction, increase] = input
  const desiredSizes = readline().split(' ').map(size => parseInt(size))
  const availableSizes = readline().split(' ').map(size => parseInt(size))

  helper(desiredSizes, availableSizes, parseInt(reduction), parseInt(increase))
}

function helper(desiredSizes, availableSizes, reduction, increase) {
    let result = []
    let currentSizeIndex = 0
    for (let i = 0; i < desiredSizes.length; i++) {

        if (availableSizes[currentSizeIndex] >= desiredSizes[i] - reduction && availableSizes[currentSizeIndex] <= desiredSizes[i] + increase) {
            result.push([i + 1, currentSizeIndex + 1])
            currentSizeIndex++
        } else {
            while (desiredSizes[i] - reduction >= availableSizes[currentSizeIndex]) {
                currentSizeIndex++
            }
            if (availableSizes[currentSizeIndex] >= desiredSizes[i] - reduction && availableSizes[currentSizeIndex] <= desiredSizes[i] + increase) {
                result.push([i + 1, currentSizeIndex + 1])
                currentSizeIndex++
            }
        }

    }

    console.log(result.length)
    result.forEach(r => console.log(r.join(' ')))
}

'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++];
}

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const input = readline().split(' ')
  const [people, vests, reduction, increase] = input
  const desiredSizes = readline().split(' ').map(size => parseInt(size))
  const availableSizes = readline().split(' ').map(size => parseInt(size))

  helper(desiredSizes, availableSizes, parseInt(reduction), parseInt(increase))
}

function helper(desiredSizes, availableSizes, reduction, increase) {
    let result = []
    let currentSizeIndex = 0
    for (let i = 0; i < desiredSizes.length; i++) {

        while (desiredSizes[i] - reduction >= availableSizes[currentSizeIndex]) {
            currentSizeIndex++
        }
        if (availableSizes[currentSizeIndex] >= desiredSizes[i] - reduction && availableSizes[currentSizeIndex] <= desiredSizes[i] + increase) {
            result.push([i + 1, currentSizeIndex + 1])
            currentSizeIndex++
        }

    }

    console.log(result.length)
    result.forEach(r=>console.log(r.join(' ')))
}

'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 printResult(x) {
    process.stdout.write(x);
}

function main() {
    const nmxy = readLine().split(' ').map(Number);
    const a = readLine().split(' ').map(Number);
    const b = readLine().split(' ').map(Number);

    const result = dressEmInVests(nmxy, a, b);
    printResult(result);
}

const dressEmInVests = (nmxy, a, b) => {
    let j = 0;
    let n = nmxy[0];
    let m = nmxy[1];
    let x = nmxy[2];
    let y = nmxy[3];
    let count = 0;
    let pairs = '';

    for (let i = 0; i < n; i++) {
        let min = a[i] - x;
        let max = a[i] + y;
        while (j < m) {
            if (b[j] < min) {
                return `${count}\n${pairs}`;
            }
            if (b[j] > max) {
                break;
            } else {
                pairs = pairs + `${i + 1} ${j + 1}\n`;
                j++;
            }
        }
        if (j === m) break;
    }

    return `${count}\n${pairs}`;
};

'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 printResult(x) {
    process.stdout.write(x);
}

function main() {
    const nmxy = readLine().split(' ').map(Number);
    const a = readLine().split(' ').map(Number);
    const b = readLine().split(' ').map(Number);

    const result = dressEmInVests(nmxy, a, b);
    printResult(result);
}

const dressEmInVests = (nmxy, a, b) => {
    let j = 0;
    let n = nmxy[0];
    let m = nmxy[1];
    let x = nmxy[2];
    let y = nmxy[3];
    let count = 0;
    let pairs = '';

    for (let i = 0; i < n; i++) {
        let min = a[i] - x;
        let max = a[i] + y;
        while (j < m) {
            if (b[j] < min) {
                return `${count}${pairs}`;
            }
            if (b[j] > max) {
                j++;
            } else {
                count++;
                pairs += `\n${i + 1} ${j + 1}`;
                j++;
                break;
            }
        }
        if (j === m) break;
    }

    return `${count}${pairs}`;
};

'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 printResult(x) {
    process.stdout.write(x);
}

function main() {
    const nmxy = readLine().split(' ').map(Number);
    const a = readLine().split(' ').map(Number);
    const b = readLine().split(' ').map(Number);

    const result = dressEmInVests(nmxy, a, b);
    printResult(result);
}

const dressEmInVests = (nmxy, a, b) => {
    let j = 0;
    let n = nmxy[0];
    let m = nmxy[1];
    let x = nmxy[2];
    let y = nmxy[3];
    let count = 0;
    let pairs = '';

    for (let i = 0; i < n; i++) {
        let min = a[i] - x;
        let max = a[i] + y;
        while (j < m) {
            if (b[j] > max) {
                return `${count}${pairs}`;
            }
            if (b[j] >= min) {
                count++;
                pairs += `\n${i + 1} ${j + 1}`;
                j++;
                break;
            }
            j++;
        }
        if (j === m) break;
    }

    return `${count}${pairs}`;
};

'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 printResult(x) {
    process.stdout.write(x);
}

function main() {
    const nmxy = readLine().split(' ').map(Number);
    const a = readLine().split(' ').map(Number);
    const b = readLine().split(' ').map(Number);

    const result = dressEmInVests(nmxy, a, b);
    printResult(result);
}

const dressEmInVests = (nmxy, a, b) => {
    let j = 0;
    let n = nmxy[0];
    let m = nmxy[1];
    let x = nmxy[2];
    let y = nmxy[3];
    let count = 0;
    let pairs = '';

    for (let i = 0; i < n; i++) {
        let min = a[i] - x;
        let max = a[i] + y;
        while (j < m) {
            if (b[j] < min) {
                return `${count}${pairs}`;
            }
            if (b[j] > max) {
                break;
            } else {
                count++;
                pairs += `\n${i + 1} ${j + 1}`;
                j++;
            }
        }
        if (j === m) break;
    }

    return `${count}${pairs}`;
};


Jeevan has two arrays $$$a$$$ and $$$b$$$ of size $$$n$$$. He is fond of performing weird operations on arrays. This time, he comes up with two types of operations:  Choose any $$$i$$$ ($$$1 \le i \le n$$$) and increment $$$a_j$$$ by $$$1$$$ for every $$$j$$$ which is a multiple of $$$i$$$ and $$$1 \le j \le n$$$.  Choose any $$$i$$$ ($$$1 \le i \le n$$$) and decrement $$$a_j$$$ by $$$1$$$ for every $$$j$$$ which is a multiple of $$$i$$$ and $$$1 \le j \le n$$$. He wants to convert array $$$a$$$ into an array $$$b$$$ using the minimum total number of operations. However, Jeevan seems to have forgotten the value of $$$b_1$$$. So he makes some guesses. He will ask you $$$q$$$ questions corresponding to his $$$q$$$ guesses, the $$$i$$$-th of which is of the form:   If $$$b_1 = x_i$$$, what is the minimum number of operations required to convert $$$a$$$ to $$$b$$$? Help him by answering each question.

The first line contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^{5})$$$  — the size of arrays $$$a$$$ and $$$b$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, ..., a_n$$$ $$$(1 \le a_i \le 10^6)$$$. The third line contains $$$n$$$ integers $$$b_1, b_2, ..., b_n$$$ $$$(1 \le b_i \le 10^6$$$ for $$$i \neq 1$$$; $$$b_1 = -1$$$, representing that the value of $$$b_1$$$ is unknown$$$)$$$. The fourth line contains a single integer $$$q$$$ $$$(1 \le q \le 2 \cdot 10^{5})$$$  — the number of questions. Each of the following $$$q$$$ lines contains a single integer $$$x_i$$$ $$$(1 \le x_i \le 10^6)$$$  — representing the $$$i$$$-th question.

Output $$$q$$$ integers  — the answers to each of his $$$q$$$ questions.

NoteConsider the first test case.  $$$b_1 = 1$$$: We need to convert $$$[3, 7] \rightarrow [1, 5]$$$. We can perform the following operations:$$$[3, 7]$$$ $$$\xrightarrow[\text{decrease}]{\text{i = 1}}$$$ $$$[2, 6]$$$ $$$\xrightarrow[\text{decrease}]{\text{i = 1}}$$$ $$$[1, 5]$$$Hence the answer is $$$2$$$. $$$b_1 = 4$$$: We need to convert $$$[3, 7] \rightarrow [4, 5]$$$. We can perform the following operations: $$$[3, 7]$$$ $$$\xrightarrow[\text{decrease}]{\text{i = 2}}$$$ $$$[3, 6]$$$ $$$\xrightarrow[\text{decrease}]{\text{i = 2}}$$$ $$$[3, 5]$$$ $$$\xrightarrow[\text{increase}]{\text{i = 1}}$$$ $$$[4, 6]$$$ $$$\xrightarrow[\text{decrease}]{\text{i = 2}}$$$ $$$[4, 5]$$$Hence the answer is $$$4$$$. $$$b_1 = 3$$$: We need to convert $$$[3, 7] \rightarrow [3, 5]$$$. We can perform the following operations:$$$[3, 7]$$$ $$$\xrightarrow[\text{decrease}]{\text{i = 2}}$$$ $$$[3, 6]$$$ $$$\xrightarrow[\text{decrease}]{\text{i = 2}}$$$ $$$[3, 5]$$$Hence the answer is $$$2$$$.

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const a = lines[l++].trim().split(' ').map(Number)
        const b = lines[l++].trim().split(' ').map(Number)
        const q = +lines[l++]
        const qs = lines.slice(l, l + q).map(str => str.trim().split(' ').map(Number))
        l += q
        output[i] = solve(n, a, b, q, qs)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, a, b, q, qs) {
    b[0] = 0

    const diff = Array(n)
    for (let i = 0; i < n; i++) {
        diff[i] = b[i] - a[i]
    }
// console.log(diff)

    const c = Array(n).fill(0)
    const d = Array(n).fill(0)
    let cd = Array(n).fill(0)
    for (let i = 0; i < n; i++) {
        cd[i] = { i }
        cd[i].c = i ? -c[i] : 1
        cd[i].d = i ? diff[i] - d[i] : 0
        cd[i].cd = -cd[i].d / cd[i].c
        for (let j = i; j < n; j += i + 1) {
            c[j] += cd[i].c
            d[j] += cd[i].d
        }
    }
// console.log(cd)

    let fixed = 0
    cd = cd.filter((item, i) => {
        if (!cd[i].c) fixed += Math.abs(cd[i].d)
        return item.c
    // }).sort((x, y) => x.cd - y.cd)
    }).sort((x, y) => {
        if (x.c > 0 && y.c > 0 || x.c < 0 && y.c < 0) {
            return -x.d * y.c - (-y.d * x.c)
        } else {
            return -(-x.d * y.c - (-y.d * x.c))
        }
    })
    // fixed = Math.abs(fixed)
// console.log('fixed=', fixed, 'cd=', cd)

    const agg = []
    for (let i = 0; i < cd.length; i++) {
        agg[i] = {
            c: (i ? agg[i - 1].c : 0) + (cd[i].c > 0 ? cd[i].c : -cd[i].c),
            d: (i ? agg[i - 1].d : 0) + (cd[i].c > 0 ? cd[i].d : -cd[i].d),
        }
    }
// console.log('agg=', agg)

    return qs.map(qx => {
        qx -= a[0]
        // const idx = binarySearch(0, cd.length - 1, x => qx > cd[x].cd)
        const idx = binarySearch(0, cd.length - 1, x => {
            if (cd[x].c > 0) {
                return qx * cd[x].c > -cd[x].d
            } else {
                return qx * cd[x].c < -cd[x].d
            }
        })
// console.log('qx=', qx, 'idx=', idx)
        const neg = agg[idx] || {c: 0, d: 0}
        const pos = {
            c: agg[cd.length - 1].c - neg.c,
            d: agg[cd.length - 1].d - neg.d,
        }
// console.log('neg=', neg, 'pos=', pos)
        return fixed + Math.abs(neg.c * qx + neg.d) + Math.abs(pos.c * qx + pos.d)
    }).join('\n')
}
function binarySearch(l, r, fn) {
    while (l <= r) {
        const m = Math.floor((l + r) / 2)
        if (fn(m)) {
            l = m + 1
        } else {
            r = m - 1
        }
    }
    return r
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const a = lines[l++].trim().split(' ').map(Number)
        const b = lines[l++].trim().split(' ').map(Number)
        const q = +lines[l++]
        const qs = lines.slice(l, l + q).map(str => str.trim().split(' ').map(Number))
        l += q
        output[i] = solve(n, a, b, q, qs)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, a, b, q, qs) {
    b[0] = 0

    const diff = Array(n)
    for (let i = 0; i < n; i++) {
        diff[i] = b[i] - a[i]
    }
// console.log(diff)

    const c = Array(n).fill(0)
    const d = Array(n).fill(0)
    let cd = Array(n).fill(0)
    for (let i = 0; i < n; i++) {
        cd[i] = { i }
        cd[i].c = i ? -c[i] : 1
        cd[i].d = i ? diff[i] - d[i] : 0
        cd[i].cd = -cd[i].d / cd[i].c
        for (let j = i; j < n; j += i + 1) {
            c[j] += cd[i].c
            d[j] += cd[i].d
        }
    }
// console.log(cd)

    let fixed = 0
    cd = cd.filter((item, i) => {
        if (!cd[i].c) fixed += cd[i].d
        return item.c
    // }).sort((x, y) => x.cd - y.cd)
    }).sort((x, y) => {
        if (x.c > 0 && y.c > 0 || x.c < 0 && y.c < 0) {
            return -x.d * y.c - (-y.d * x.c)
        } else {
            return -(-x.d * y.c - (-y.d * x.c))
        }
    })
    fixed = Math.abs(fixed)
// console.log('fixed=', fixed, 'cd=', cd)

    const agg = []
    for (let i = 0; i < cd.length; i++) {
        agg[i] = {
            c: (i ? agg[i - 1].c : 0) + (cd[i].c > 0 ? cd[i].c : -cd[i].c),
            d: (i ? agg[i - 1].d : 0) + (cd[i].c > 0 ? cd[i].d : -cd[i].d),
        }
    }
// console.log('agg=', agg)

    return qs.map(qx => {
        qx -= a[0]
        // const idx = binarySearch(0, cd.length - 1, x => qx > cd[x].cd)
        const idx = binarySearch(0, cd.length - 1, x => {
            if (cd[x].c > 0) {
                return qx * cd[x].c > -cd[x].d
            } else {
                return qx * cd[x].c < -cd[x].d
            }
        })
// console.log('qx=', qx, 'idx=', idx)
        const neg = agg[idx] || {c: 0, d: 0}
        const pos = {
            c: agg[cd.length - 1].c - neg.c,
            d: agg[cd.length - 1].d - neg.d,
        }
// console.log('neg=', neg, 'pos=', pos)
        return fixed + Math.abs(neg.c * qx + neg.d) + Math.abs(pos.c * qx + pos.d)
    }).join('\n')
}
function binarySearch(l, r, fn) {
    while (l <= r) {
        const m = Math.floor((l + r) / 2)
        if (fn(m)) {
            l = m + 1
        } else {
            r = m - 1
        }
    }
    return r
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const a = lines[l++].trim().split(' ').map(Number)
        const b = lines[l++].trim().split(' ').map(Number)
        const q = +lines[l++]
        const qs = lines.slice(l, l + q).map(str => str.trim().split(' ').map(Number))
        l += q
        output[i] = solve(n, a, b, q, qs)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, a, b, q, qs) {
    b[0] = 0

    const diff = Array(n)
    for (let i = 0; i < n; i++) {
        diff[i] = b[i] - a[i]
    }
// console.log(diff)

    const c = Array(n).fill(0)
    const d = Array(n).fill(0)
    let cd = Array(n).fill(0)
    for (let i = 0; i < n; i++) {
        cd[i] = { i }
        cd[i].c = i ? -c[i] : 1
        cd[i].d = i ? diff[i] - d[i] : 0
        cd[i].cd = -cd[i].d / cd[i].c
        for (let j = i; j < n; j += i + 1) {
            c[j] += cd[i].c
            d[j] += cd[i].d
        }
    }
// console.log(cd)

    let fixed = 0
    cd = cd.filter((item, i) => {
        if (!cd[i].c) fixed += cd[i].d
        return item.c
    }).sort((x, y) => x.cd - y.cd)
    fixed = Math.abs(fixed)
// console.log('fixed=', fixed, 'cd=', cd)

    const agg = []
    for (let i = 0; i < cd.length; i++) {
        agg[i] = {
            c: (i ? agg[i - 1].c : 0) + (cd[i].c > 0 ? cd[i].c : -cd[i].c),
            d: (i ? agg[i - 1].d : 0) + (cd[i].c > 0 ? cd[i].d : -cd[i].d),
        }
    }
// console.log('agg=', agg)

    return qs.map(qx => {
        qx -= a[0]
        const idx = binarySearch(0, cd.length - 1, x => qx > cd[x].cd)
// console.log('qx=', qx, 'idx=', idx)
        const neg = agg[idx] || {c: 0, d: 0}
        const pos = {
            c: agg[cd.length - 1].c - neg.c,
            d: agg[cd.length - 1].d - neg.d,
        }
// console.log('neg=', neg, 'pos=', pos)
        return fixed + Math.abs(neg.c * qx + neg.d) + Math.abs(pos.c * qx + pos.d)
    }).join('\n')
}
function binarySearch(l, r, fn) {
    while (l <= r) {
        const m = Math.floor((l + r) / 2)
        if (fn(m)) {
            l = m + 1
        } else {
            r = m - 1
        }
    }
    return r
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const a = lines[l++].trim().split(' ').map(Number)
        const b = lines[l++].trim().split(' ').map(Number)
        const q = +lines[l++]
        const qs = lines.slice(l, l + q).map(str => str.trim().split(' ').map(Number))
        l += q
        output[i] = solve(n, a, b, q, qs)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, a, b, q, qs) {
    b[0] = 0

    const diff = Array(n)
    for (let i = 0; i < n; i++) {
        diff[i] = b[i] - a[i]
    }
// console.log(diff)

    const c = Array(n).fill(0)
    const d = Array(n).fill(0)
    let cd = Array(n).fill(0)
    for (let i = 0; i < n; i++) {
        cd[i] = { i }
        cd[i].c = i ? -c[i] : 1
        cd[i].d = i ? diff[i] - d[i] : 0
        cd[i].cd = -cd[i].d / cd[i].c
        for (let j = i; j < n; j += i + 1) {
            c[j] += cd[i].c
            d[j] += cd[i].d
        }
    }
// console.log(cd)

    let fixed = 0
    cd = cd.filter((item, i) => {
        if (!cd[i].c) fixed += cd[i].d
        return item.c
    }).sort((x, y) => x.cd - y.cd)
// console.log('fixed=', fixed, 'cd=', cd)

    const agg = []
    for (let i = 0; i < cd.length; i++) {
        agg[i] = {
            c: (i ? agg[i - 1].c : 0) + (cd[i].c > 0 ? cd[i].c : -cd[i].c),
            d: (i ? agg[i - 1].d : 0) + (cd[i].c > 0 ? cd[i].d : -cd[i].d),
        }
    }
// console.log('agg=', agg)

    return qs.map(qx => {
        qx -= a[0]
        const idx = binarySearch(0, cd.length - 1, x => qx > cd[x].cd)
// console.log('qx=', qx, 'idx=', idx)
        const neg = agg[idx] || {c: 0, d: 0}
        const pos = {
            c: agg[cd.length - 1].c - neg.c,
            d: agg[cd.length - 1].d - neg.d,
        }
// console.log('neg=', neg, 'pos=', pos)
        return fixed + Math.abs(neg.c * qx + neg.d) + Math.abs(pos.c * qx + pos.d)
    }).join('\n')
}
function binarySearch(l, r, fn) {
    while (l <= r) {
        const m = Math.floor((l + r) / 2)
        if (fn(m)) {
            l = m + 1
        } else {
            r = m - 1
        }
    }
    return r
}


Petya and Vasya are brothers. Today is a special day for them as their parents left them home alone and commissioned them to do n chores. Each chore is characterized by a single parameter — its complexity. The complexity of the i-th chore equals hi.As Petya is older, he wants to take the chores with complexity larger than some value x (hi > x) to leave to Vasya the chores with complexity less than or equal to x (hi ≤ x). The brothers have already decided that Petya will do exactly a chores and Vasya will do exactly b chores (a + b = n).In how many ways can they choose an integer x so that Petya got exactly a chores and Vasya got exactly b chores?

The first input line contains three integers n, a and b (2 ≤ n ≤ 2000; a, b ≥ 1; a + b = n) — the total number of chores, the number of Petya's chores and the number of Vasya's chores. The next line contains a sequence of integers h1, h2, ..., hn (1 ≤ hi ≤ 109), hi is the complexity of the i-th chore. The numbers in the given sequence are not necessarily different. All numbers on the lines are separated by single spaces.

Print the required number of ways to choose an integer value of x. If there are no such ways, print 0.

NoteIn the first sample the possible values of x are 3, 4 or 5.In the second sample it is impossible to find such x, that Petya got 3 chores and Vasya got 4.

'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() {
  const [n, a, b] = readline().split(' ').map(Number)
  const h = readline().split(' ').map(Number)

  helper(n, a, b, h)
}

function helper(n, a, b, h) {
    h.sort((a1,a2)=>a1 - a2)

    console.log((h[b] - h[b - 1]) + '')
}

'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 printResult(x) {
    process.stdout.write(x);
}

function main() {
    const nmk = readLine().split(' ').map(Number);
    const arr = readLine().split(' ').map(Number);

    const result = chores(nmk[0],nmk[1],nmk[2],arr);
    printResult(result.toString());
}

const chores = (n, m, k, a) => {
    a.sort((x, y) => x - y);
    return a[k] - a[k-1] > 0 ? a[k] - a[k-1] : 0;
};

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

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

  const arr = d.split(' ').map(Number);
  arr.sort((a, b) => b - a);

  let boy1 = arr[a - 1];
  let boy2 = arr[a];

  console.log(boy1 - boy2);

  c++;
});

let data = '';
process.stdin.on('data',v => data += v);
const solution = () => {
	let line = data.split('\n');
	let [n, a, b] = line[0].split(' ').map(v => parseInt(v,10));
	let d = line[1].split(' ').map(v => parseInt(v,10));
	d.sort((a, b) => a - b);
	console.log(d[b] - d[b-1]);
	process.exit(0);
}

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

'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() {
  const [n, a, b] = readline().split(' ').map(Number)
  const h = readline().split(' ').map(Number)

  helper(n, a, b, h)
}

function helper(n, a, b, h) {
    h.sort((a1,a2)=>a1 - a2)

    if (h[a + 1] !== h[a])
        console.log(h[a] + '')
    else
        console.log('0')
}

'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() {
  const [n, a, b] = readline().split(' ').map(Number)
  const h = readline().split(' ').map(Number)

  helper(n, a, b, h)
}

function helper(n, a, b, h) {
    h.sort((a1,a2)=>a1 - a2)

    if (h[a - 1] !== h[a])
        console.log(h[a - 1])
    else
        console.log(0)
}

'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() {
  const [n, a, b] = readline().split(' ').map(Number)
  const h = readline().split(' ').map(Number)

  helper(n, a, b, h)
}

function helper(n, a, b, h) {
    h.sort((a1,a2)=>a1 - a2)

    if (h[b] !== h[b - 1])
        console.log(h[b - 1] + '')
    else
        console.log('0')
}

'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 printResult(x) {
    process.stdout.write(x);
}

function main() {
    const nmk = readLine().split(' ').map(Number);
    const arr = readLine().split(' ').map(Number);

    const result = chores(nmk[0],nmk[1],nmk[2],arr);
    printResult(result.toString());
}

const chores = (n, m, k, a) => {
    a.sort((x, y) => x - y);
    return a[k] - a[k-1] > 0 ? a[k-1] : 0;
};

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

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

  const arr = d.split(' ').map(Number);
  arr.sort((a, b) => a - b);

  if (arr[b] > b && arr[b -1] <= b) {
    console.log(arr[b] = arr[b - 1]);
  }
  else {
    console.log(0);
  }

  c++;
});


Given an array $$$a$$$ of length $$$n$$$, find another array, $$$b$$$, of length $$$n$$$ such that:  for each $$$i$$$ $$$(1 \le i \le n)$$$ $$$MEX(\{b_1$$$, $$$b_2$$$, $$$\ldots$$$, $$$b_i\})=a_i$$$. The $$$MEX$$$ of a set of integers is the smallest non-negative integer that doesn't belong to this set.If such array doesn't exist, determine this.

The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of the array $$$a$$$. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, $$$\ldots$$$, $$$a_n$$$ ($$$0 \le a_i \le i$$$) — the elements of the array $$$a$$$. It's guaranteed that $$$a_i \le a_{i+1}$$$ for $$$1\le i < n$$$.

If there's no such array, print a single line containing $$$-1$$$. Otherwise, print a single line containing $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, $$$\ldots$$$, $$$b_n$$$ ($$$0 \le b_i \le 10^6$$$) If there are multiple answers, print any.

NoteIn the second test case, other answers like $$$[1,1,1,0]$$$, for example, are valid.

// var lineIdx = 0;
// var readline = () => {
//   var input = ["3", "1 1 3"]
//   return input[lineIdx++];
// };
// var print = (str) => {
//   console.log(str);
// };

var t = readline().split(" ").map(function (x) { return parseInt(x); })[0];

var row = readline().split(" ").map(function (x) { return parseInt(x); });

var source = new Array();
var res = new Array();

var idx = 0;

for(var i = 0; i<= t*2; i++){
  if(idx < row.length && row[idx] == i){
    while(row[idx] == i && idx < row.length) {
      idx ++;
    }
  } else{
    source.push(i)
  }
}

var last = -1;
idx = 0;
for(var j = 0; j < row.length; j++){
  if(j != 0 && row[j] != last){
    res.push(last)
  } else {
    res.push(source[idx++])
  }
  last = row[j]
}

print(res.join(' '))


Harry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Secrets. Harry wants to know the different people who had ever possessed the diary to make sure they are not under its influence.He has names of n people who possessed the diary in order. You need to tell, for each person, if he/she possessed the diary at some point before or not.Formally, for a name si in the i-th line, output "YES" (without quotes) if there exists an index j such that si = sj and j < i, otherwise, output "NO" (without quotes).

First line of input contains an integer n (1 ≤ n ≤ 100) — the number of names in the list. Next n lines each contain a string si, consisting of lowercase English letters. The length of each string is between 1 and 100.

Output n lines each containing either "YES" or "NO" (without quotes), depending on whether this string was already present in the stream or not. You can print each letter in any case (upper or lower).

NoteIn test case 1, for i = 5 there exists j = 3 such that si = sj and j < i, which means that answer for i = 5 is "YES".

//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 set = new Set();
	var output = new Array(N);
	for(var i = 0; i < N; i++){
		var s = next();
		if(set.has(s)){
			output[i] = "YES";
		}else{
			set.add(s);
			output[i] = "NO";
		}
	}
	myout(myconv(output, 9));
}

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

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  if (obj[d]) {
    console.log('YES');
  }
  else {
    console.log('NO');
    obj[d] = true;
  }

  c++;
});

let input = [];

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

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

RL.on('close', () => {
    let n = parseInt(input[0]);

    let names = new Set();
    for(let i = 0; i < n; i++){
        if (names.has(input[i+1])) {
            console.log('YES');
        } else {
            console.log('NO');
        }
        names.add(input[i+1]);
    }
});

var n = readline();
var array =[];
for(var i =0; i<n; i++){
array.push(readline());
}

for(var i =0; i<n; i++){
   var flag=false;
   for (var j =0; j<i; j++){
   	if(array[j]===array[i]){
   		flag = true;
   	}
   }
   //print((flag):"YES"?"NO");
   if(flag === true)
   	print("YES");
   else
   	print("NO");
}

/**
 * Created by lukask on 9/24/17.
 */
var i;
var namesMap = {};
var streamLength = readline();
for (i = 0; i < streamLength; i++) {
  var entry = readline();
  if (namesMap[entry] === undefined) {
    print('NO');
    namesMap[entry] = true;
  } else {
    print('YES');
  }
}

var n = parseInt(readline());
var inpStr = "", data = [];
var i = 0, k = 0, m = 0;

for(i=0;i<n;i++)
{
  inpStr = readline();

  m = data.length;
  flag = 0;
  for(k=0;k<m;k++)
  {
    if(inpStr == data[k])
    {
      flag = 1;
    }
  }

  if(flag ==1)
  {
    print("YES");
  }
  else
  {
    print("NO");
    data.push(inpStr);
  }

}

(function() {
    'use strict';
    let n = readline();
    let y = [];
    for(let i = 0; i < n; i++) {
        let x = readline();
        y += x + ' ';
    }
    let z = y.split(' ').map(String);
    for (let i = 0; i < n; i++) {
    var re1 = new RegExp('\\b' + z[i] + '\\b');
    var re = new RegExp('\\b' + z[i] + '\\b', 'g');
    y = y.replace(re1, 'NO');
    y = y.replace(re, 'YES');
    }
    y = y.split(' ').map(String);
    for (let i = 0; i < n; i++) {
        print(y[i]);
    }
}());

var n = parseInt(readline());
var names = {};

for (var i = 0; i < n; i++) {
    var name = readline();

    if (names[name]) {
      print('YES');
    } else {
      names[name] = true;
      print('NO');
    }
}

function main(stdin) {
  const lines = stdin.split("\n");
  const before = new Set();
  lines.slice(1, 1 + parseInt(lines[0])).forEach(v => {
    console.log(before.has(v) ? "YES" : "NO");
    before.add(v);
  });
}

main(require("fs").readFileSync(0, "utf-8"));

var n = parseInt(readline());
var inpStr = "", data = [];
var i = 0, k = 0, m = 0;

for(i=0;i<n;i++)
{
  inpStr = readline();

  m = data.lenght;
  flag = 0;
  for(k=0;k<m;k++)
  {
    if(inpStr == data[k])
    {
      flag = 1;
    }
  }

  if(flag ==1)
  {
    print("YES");
  }
  else
  {
    print("NO");
    data.push(inpStr);
  }

}

(function() {
    'use strict';
    let n = readline();
    let y = [];
    for(let i = 0; i < n; i++) {
        let x = readline();
        y += x + ' ';
    }
    let z = y.split(' ').map(String);
    for (let i = 0; i < n; i++) {
    var re = new RegExp(z[i], 'g');
    y = y.replace(z[i], 'NO');
    y = y.replace(re, 'YES');
    }
    y = y.split(' ').map(String);
    for (let i = 0; i < n; i++) {
        print(y[i]);
    }
}());

function main(stdin) {
  const lines = stdin.split("\n");
  const before = new Set();
  lines.slice(1, 1 + parseInt(lines[0])).forEach(v => {
    console.log(before.has(v) ? "YES" : "NO");
    before.add(v);
  });
}

main(
  require("fs")
    .readFileSync(0, "utf-8")
    .trim()
);

function main(stdin) {
  const lines = stdin.split("\n");
  const before = new Set();
  lines.slice(1).forEach(v => {
    console.log(before.has(v) ? "YES" : "NO");
    before.add(v);
  });
}

main(
  require("fs")
    .readFileSync(0, "utf-8")
    .trim()
);


Bob wants to put a new bargaining table in his office. To do so he measured the office room thoroughly and drew its plan: Bob's office room is a rectangular room n × m meters. Each square meter of the room is either occupied by some furniture, or free. A bargaining table is rectangular, and should be placed so, that its sides are parallel to the office walls. Bob doesn't want to change or rearrange anything, that's why all the squares that will be occupied by the table should be initially free. Bob wants the new table to sit as many people as possible, thus its perimeter should be maximal. Help Bob find out the maximum possible perimeter of a bargaining table for his office.

The first line contains 2 space-separated numbers n and m (1 ≤ n, m ≤ 25) — the office room dimensions. Then there follow n lines with m characters 0 or 1 each. 0 stands for a free square meter of the office room. 1 stands for an occupied square meter. It's guaranteed that at least one square meter in the room is free.

Output one number — the maximum possible perimeter of a bargaining table for Bob's office room.

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var integers = tokenizeIntegers(readline());
	var rowNum = integers[0], colNum = integers[1];

	var room = [];
	for (var r = 0; r < rowNum; r += 1) {
		room.push(trim(readline()));
	}

	function isClear(fromR, fromC, toR, toC) {
		for (var r = fromR; r <= toR; r += 1) {
			for (var c = fromC; c <= toC; c += 1) {
				if (room[r].charAt(c) == '1') {
					return false;
				}
			}
		}
		return true;
	}

	var bestPerimeter = 0;

	for (var fromR = 0; fromR < rowNum; fromR += 1) {
		for (var fromC = 0; fromC < colNum; fromC += 1) {
			for (var toR = fromR; toR < rowNum; toR += 1) {
				for (var toC = fromC; toC < colNum; toC += 1) {
					if (isClear(fromR, fromC, toR, toC)) {
						bestPerimeter = Math.max(bestPerimeter,
								2*(toR-fromR+1) + 2*(toC-fromC+1));
					}
				}
			}
		}
	}

	print(bestPerimeter);
}

main();

'use strict'

let lll = readline().split(' ').map(v => parseInt(v))

const N = lll[0]
const M = lll[1]

const rm  = []

while (lll = readline()) {
  rm.push(lll.split('').map(v => parseInt(v)))
}

const pt = (rm, x, y) => {
  let xx = x
  let yy = y
  while (rm[yy][++xx] == 0) {}
  while (++yy < rm.length && rm[yy].slice(x, xx).reduce((e, c) => e || c, null) == 0) {}
  let p1 = 2 * (xx - x) + 2 * (yy - y)
  xx = x
  yy = y
  while (rm[yy + 1] && rm[++yy][xx] == 0) {}
  while(++xx < rm[0].length && rm.map(l => l[xx]).slice(y, yy).reduce((e, c) => e || c, null) == 0) {}
  let p2 = 2 * (xx - x) + 2 * (yy - y)
  return Math.max(p1, p2)
}

let max = 0

for (let i = 0; i < rm.length; i++) {
  for (let j = 0; j < rm[0].length; j++) {
    if (!rm[i][j]) max = Math.max(max, pt(rm, j, i))
  }
}

print(max)


Vanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom to top, the columns are numbered from 1 to 100 from left to right. In this table, Vanya chose n rectangles with sides that go along borders of squares (some rectangles probably occur multiple times). After that for each cell of the table he counted the number of rectangles it belongs to and wrote this number into it. Now he wants to find the sum of values in all cells of the table and as the table is too large, he asks you to help him find the result.

The first line contains integer n (1 ≤ n ≤ 100) — the number of rectangles. Each of the following n lines contains four integers x1, y1, x2, y2 (1 ≤ x1 ≤ x2 ≤ 100, 1 ≤ y1 ≤ y2 ≤ 100), where x1 and y1 are the number of the column and row of the lower left cell and x2 and y2 are the number of the column and row of the upper right cell of a rectangle.

In a single line print the sum of all values in the cells of the table.

NoteNote to the first sample test:Values of the table in the first three rows and columns will be as follows:121121110So, the sum of values will be equal to 10.Note to the second sample test:Values of the table in the first three rows and columns will be as follows:222222222So, the sum of values will be equal to 18.

var n = +readline();
var input, x1, y1, x2, y2, cnt = 0;

for(i = 0; i < n; i++){
	input = readline().split(" ").map(Number);
	x1 = input[0], y1 = input[1], x2 = input[2], y2 = input[3];

	cnt += (Math.abs(x2 - x1) + 1) * (Math.abs(y2 - y1) + 1);
}

write(cnt);

// Code belogs to CyberZHG I am just testing something...
// http://codeforces.com/contest/552/submission/11679521

var n = parseInt(readline());
var ans = 0;
while (n--) {
    var nums = readline().split(' ').map(Number);
    ans += (nums[2] - nums[0] + 1) * (nums[3] - nums[1] + 1);
}
print(ans);

function ProblemSolver() {
    this.HAS_TEST_CASES = false ;
    this.INPUT_FILE_NAME = "sample.in" ;
    this.OUTPUT_FILE_NAME = "sample.out" ;
    this.DO_OUTPUT_TO_FILE = false ;
    this.CLEAR_ARRAY_PER_CASE = true ;

    this.solveCase = function() {
        var res , i , j , fl , cn , a , b , c , d , k ;
        res = 0 ;
        for( i = 0 ; i < 4 * this.n ; i += 4 ) {
            a = this.arr[ i + 0 ] ;
            b = this.arr[ i + 1 ] ;
            c = this.arr[ i + 2 ] ;
            d = this.arr[ i + 3 ] ;
            for( j = a ; j <= c ; j++ ) {
                for( k = b ; k <= d ; k++ ) {
                    this.done[ j ][ k ]++ ;
                }
            }
        }
        for( j = 1 ; j <= 100 ; j++ ) {
            for( k = 1 ; k <= 100 ; k++ ) {
                res += this.done[ j ][ k ] ;
            }
        }
        print( res ) ;
    } ;

    this.init = function() {
        this.lim1 = 100010 ;
        this.lim2 = 110 ;
        this.cc = 1 ;
        this.ind = 1 ;
        this.n = 0 ;
        this.cn = 0 ;
        this.declareAndFillArrays() ;
    } ;

    this.getInput = function( irObj ) {
        var hasMoreInput , i ;
        hasMoreInput = true ;
        try {
        	this.n = irObj.nextInt() ;
            this.arr = [] ;
            for( i = 0 ; i < this.n ; i++ ) {
                this.arr.push( irObj.nextInt() ) ;
                this.arr.push( irObj.nextInt() ) ;
                this.arr.push( irObj.nextInt() ) ;
                this.arr.push( irObj.nextInt() ) ;
            }
        }
        catch( ex ) {
            hasMoreInput = false ;
        }
        return hasMoreInput ;
    } ;

    this.clearArraysPerCase = function() {
        var i , j ;
        this.arr = new Array() ;
        this.adjList = new Array() ;
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.arr.push( 0 ) ;
            this.adjList.push( new Array() ) ;
        }
        this.memo = new Array() ;
        this.done = new Array() ;
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() ) ;
            this.done.push( new Array() ) ;
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( -1 ) ;
                this.done[ i ].push( 0 ) ;
            }
        }
    } ;

    this.clearPerCase = function() {
        this.cn = 0 ;
        this.cc++ ;
        if( this.CLEAR_ARRAY_PER_CASE == true ) {
            this.clearArraysPerCase() ;
        }
    } ;

    this.declareAndFillArrays = function() {
        var i , j ;
        this.srr = new Array() ;
        this.vis = new Array() ;
        this.arr = new Array() ;
        this.brr = new Array() ;
        this.memo = new Array() ;
        this.done = new Array() ;
        this.adjList = new Array() ;
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( '' ) ;
            this.vis.push( 0 ) ;
            this.arr.push( 0 ) ;
            this.brr.push( 0 ) ;
            this.adjList.push( new Array() ) ;
        }
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() ) ;
            this.done.push( new Array() ) ;
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( -1 ) ;
                this.done[ i ].push( 0 ) ;
            }
        }
    } ;

    this.init() ;
}

function InputReader() {
    var self = this ;
    this.allLines = new Array() ;
    this.currrentLineNumber = 0 ;
    this.currrentCharacterIndex = 0 ;
    this.callBackFunction = null ;
    this.parentContext = null ;

    this.readAllLines = function() {
        var singleLine ;
        while( true ) {
            try {
                singleLine = readline() ;
                if( singleLine == null ) {
                    break ;
                }
            }
            catch( ex ) {
                break ;
            }
            this.allLines.push( singleLine ) ;
        }
    } ;

    this.readAllLinesFromRhino = function() {
        var brObj , line ;
        importPackage( java.io ) ;
        importPackage( java.lang ) ;
        brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;
        this.allLines = [] ;
        while( true ) {
            line = brObj.readLine() ;
            if( line == null ) {
                break;
            }
            this.allLines.push( line ) ;
        }
    } ;

    this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {
        self.chunkData += chunk ;
    } ;

    this.readEndFromNodeJsJudgeServer = function() {
        self.parseRawData( self.chunkData ) ;
        self.parentContext.runCases() ;
    } ;

    this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {
        this.parentContext = parentContext ;
        process.stdin.resume() ;
        process.stdin.setEncoding( 'utf8' ) ;
        this.chunkData = '' ;
        process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;
        process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;
    } ;

    this.parseRawData = function( data ) {
        var len , i , currentString ;
        len = data.length ;
        currentString = '' ;
        this.allLines = [] ;
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString ) ;
                currentString = '' ;
            }
            else {
                currentString += data[ i ] ;
            }
        }
        if( currentString != '' ) {
            this.allLines.push( currentString ) ;
        }
    } ;

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData ;
        fsObj = require( 'fs' ) ;
        currentDirectory = __dirname ;
        if( currentDirectory.indexOf( 'D:' ) != -1 ) {
            //on windows
            inputFilePath = currentDirectory + '\\' + inputFileName ;
        }
        else {
            //on linux
            inputFilePath = currentDirectory + '/' + inputFileName ;
        }
        rawData = fsObj.readFileSync( inputFilePath , "utf8" ) ;
        this.parseRawData( rawData ) ;
    } ;

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx ;
        if( flag == 0 ) {
            if( this.currrentCharacterIndex != 0 ) {
                this.currrentLineNumber++ ;
                this.currrentCharacterIndex = 0 ;
            }
            res = '' ;
            len = this.allLines[ this.currrentLineNumber ].length ;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;
            }
            this.currrentLineNumber++ ;
            this.currrentCharacterIndex = 0 ;
            return res ;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( 'No more tokens available!' ) ;
            }
            startIdx = -1 ;
            len = this.allLines[ this.currrentLineNumber ].length ;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {
                    startIdx = i ;
                    break ;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++ ;
                this.currrentCharacterIndex = 0 ;
                continue ;
            }
            res = '' ;
            endIdx = len - 1 ;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {
                    endIdx = i ;
                    break ;
                }
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {
                    res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;
                }
                else {
                    res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;
                }
            }
            this.currrentCharacterIndex = endIdx ;
            if( endIdx == len - 1 ) {
                this.currrentLineNumber++ ;
                this.currrentCharacterIndex = 0 ;
            }
            return res ;
        }
    } ;

    this.nextInt = function() {
        return parseInt( this.next( 1 ) ) ;
    } ;

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) ) ;
    } ;

    this.nextString = function() {
        return this.next( 1 ) ;
    } ;

    this.nextLine = function() {
        return this.next( 0 ) ;
    } ;
}

function FileOutputHandler() {
    this.resultantStringArray = new Array() ;

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString ) ;
    } ;

    this.clearPercase = function() {
        this.resultantStringArray = new Array() ;
    } ;

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath ;
        res = '' ;
        sz = this.resultantStringArray.length ;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += '\n' ;
            }
            res += this.resultantStringArray[ i ] ;
        }
        fsObj = require( 'fs' ) ;
        currentDirectory = __dirname ;
        if( currentDirectory.indexOf( 'D:' ) != -1 ) {
            //on windows
            outputFilePath = currentDirectory + '\\' + outputFileName ;
        }
        else {
            //on linux
            outputFilePath = currentDirectory + '/' + outputFileName ;
        }
        fsObj.writeFileSync( outputFilePath , res ) ;
        this.clearPercase() ;
    } ;
}

function CodeExecutioner() {
    this.irObj = new InputReader() ;
    this.psObj = new ProblemSolver() ;
    this.fohObj = new FileOutputHandler() ;

    this.runCases = function() {
		var testCases , hasMoreTestCases , i ;
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt() ;
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase() ;
                this.psObj.getInput( this.irObj ) ;
                this.psObj.solveCase() ;
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase() ;
                hasMoreTestCases = this.psObj.getInput( this.irObj ) ;
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase() ;
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME ) ;
        }
    } ;

    this.detectEnvironmentType = function() {
        var environmentType = null ;
        try {
            if( importPackage != null ) {
                environmentType = 'rhino' ;
            }
        }
        catch( ex1 ) {
            try {
                //for nodejs local server check
                if( __dirname != null && ( __dirname.indexOf( 'D:') != -1 || __dirname.indexOf( '/media/') != -1 ) ) {
                    environmentType = 'local-node-js' ;
                }
                else {
                    environmentType = 'server-node-js' ;
                }
            }
            catch( ex2 ) {
                try {
                    if( readline == null || typeof( readline ) != 'function' ) {
                        environmentType = 'server-node-js' ;
                    }
                    else {
                        try {
                            if( Map != null ) {
                                environmentType = 'spider-monkey' ;
                            }
                            else {
                                environmentType = 'javascript-v8' ;
                            }
                        }
                        catch( ex3 ) {
                            environmentType = 'javascript-v8' ;
                        }
                    }
                }
                catch( ex3 ) {
                    environmentType = 'server-node-js' ;
                }
            }
        }
        return environmentType ;
    } ;

    this.configureStreamsAndReadInput = function() {
        var localContext , isNodeJsJudgeServer , environmentType ;
        isNodeJsJudgeServer = false ;
        environmentType = this.detectEnvironmentType() ;
        if( environmentType == 'local-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log ;
                }
            }
            catch( ex ) {
                print = console.log ;
            }
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj ;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments ) ;
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME ) ;
            this.runCases() ;
        }
        else if( environmentType == 'server-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log ;
                }
            }
            catch( ex ) {
                print = console.log ;
            }
            this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;
        }
        else if( environmentType == 'javascript-v8' ) {
            this.irObj.readAllLines() ;
            this.runCases() ;
        }
        else if( environmentType == 'rhino' ) {
            this.irObj.readAllLinesFromRhino() ;
            this.runCases() ;
        }
        else if( environmentType == 'spider-monkey' ) {
            this.irObj.readAllLines() ;
            this.runCases() ;
        }
    } ;

    this.configureStreamsAndReadInput() ;
}

new CodeExecutioner() ;

function toi(x){return parseInt(x);}
(function(){
    var n=+readline();
    var s=0;
    for(var i=0;i<n;i++){
	var t=readline().split(" ").map(toi);
	s+=(t[2]-t[0]+1)*(t[3]-t[1]+1);
    }
    print(s);
})();


Define the score of some binary string $$$T$$$ as the absolute difference between the number of zeroes and ones in it. (for example, $$$T=$$$ 010001 contains $$$4$$$ zeroes and $$$2$$$ ones, so the score of $$$T$$$ is $$$|4-2| = 2$$$).Define the creepiness of some binary string $$$S$$$ as the maximum score among all of its prefixes (for example, the creepiness of $$$S=$$$ 01001 is equal to $$$2$$$ because the score of the prefix $$$S[1 \ldots 4]$$$ is $$$2$$$ and the rest of the prefixes have a score of $$$2$$$ or less).Given two integers $$$a$$$ and $$$b$$$, construct a binary string consisting of $$$a$$$ zeroes and $$$b$$$ ones with the minimum possible creepiness.

The first line contains a single integer $$$t$$$ $$$(1\le t\le 1000)$$$  — the number of test cases. The description of the test cases follows. The only line of each test case contains two integers $$$a$$$ and $$$b$$$ ($$$ 1 \le a, b \le 100$$$)  — the numbers of zeroes and ones correspondingly.

For each test case, print a binary string consisting of $$$a$$$ zeroes and $$$b$$$ ones with the minimum possible creepiness. If there are multiple answers, print any of them.

NoteIn the first test case, the score of $$$S[1 \ldots 1]$$$ is $$$1$$$, and the score of $$$S[1 \ldots 2]$$$ is $$$0$$$.In the second test case, the minimum possible creepiness is $$$1$$$ and one of the other answers is 101.In the third test case, the minimum possible creepiness is $$$3$$$ and one of the other answers is 0001100.

'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 output(x) {
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let i = 0; i < N; i++) {
        let [zeros, ones] = readline().split(' ').map(Number);

        let min = Math.min(zeros, ones);
        let max = Math.max(zeros, ones);
        let diff = max - min;
        let moreOf = zeros > ones ? '0': '1';

        let result = ('01').repeat(min);
        result += moreOf.repeat(diff);

        output(result);
    }
}

'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 output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    const cases = readline();

    for (let i = 0; i < cases; i++) {
        const n = readline();
        let [zeros, ones] = n.split(' ').map(Number);
        let max = Math.max(zeros, ones);
        let min = Math.min(zeros, ones);
        let rep = zeros > ones ? '01' : '10';
        let suff = zeros > ones ? '0' : '1';
        let result = rep.repeat(min);
        result = result + suff.repeat(max - min);
        output(result);
    }
}

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
	var t = lines[0];
	var n = 0;
	for(i = 1; i <= t; i++){
        var k = lines[i].split(' ').map(Number);
        var x = k[0], y = k[1];
        var ans = '';
        while(x !== 0 && y !== 0){
            ans += '01';
            x--;
            y--;
        }
        while(x !== 0){
            ans += '0';
            x--;
        }
        while(y !== 0){
            ans += '1';
            y--;
        }
        console.log(ans);
    }
});

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\r\n');
let currentline = 0;
function readline(){
      return input[currentline++];
}
var T = readline();
for(var qe=1;qe<=T;qe++) {
  //var n = readline()//.split(' ').map((x) => parseInt(x));
  var [a, b] = readline().split(' ').map((x) => parseInt(x));
  var ans = '';
  if(a>=b){
       for(var i=0;i<b;i++){
            ans+="01";
       }
       for(var i=0;i<a-b;i++){
            ans+="0";
       }
  }
  else{
        for(var i=0;i<a;i++){
            ans+="10";
       }
       for(var i=0;i<b-a;i++){
            ans+="1";
       }
  }

  console.log(ans)

}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

function main() {
  var t = parseInt(readline())

while(t--){
    var s = readline()
    var x = s.split(' ')
    var a = parseInt(x[0])
    var b = parseInt(x[1])
    var str = ''
    var flag = false
    while(a>0 || b>0){
        if(flag === false && a>0){
            str+='0'
            if(b>0) flag = true
            a--
        }
        else if(flag === true && b>0){
            str+='1'
            if(a>0) flag = false
            b--
        }
    }
    console.log(str)
}

}

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\r\n');
let currentline = 0;
function readline(){
      return input[currentline++];
}

function alph() {
  var f = 'abcdefghijklmnopqrstuvwxyz';
  return f;
}
function Alph() {
  var f = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  return f;
}
function max(x,y) {
  return x >=y ? x : y;
}
function min(x,y) {
  return x <=y ? x : y;
}
function abs(x) {
  return x < 0 ? x*(-1) : x;
}

var T = readline();
for(var qe=1;qe<=T;qe++) {
  //var n = readline()//.split(' ').map((x) => parseInt(x));
  var [a, b] = readline().split(' ').map((x) => parseInt(x));
  var ans = '';
  var x = a, j = b;
  var iNext = false, jNext = true;
  for(var i=0;i<(a+b);i++) {
    if(iNext) {
      if(x > 0) {
        x--;
        ans += 0;
        iNext = false;
        jNext = true;
        continue;
      }
    }
    if(jNext) {
      if(j > 0) {
        j--;
        ans += 1;
        iNext = true;
        jNext = false;
        continue;
      }
    }
    if(x > 0) {
      x--
      ans += 0;
      continue;
    }
    if(j > 0) {
      j--;
      ans += 1;
    }
  }

  console.log(ans)
  //fs.appendFileSync('output.txt', ans+'\r\n');

}
//

'use strict';

function solve(n, m) {
  let res = [];
  const a = Math.min(n, m);
  for (let i = 0; i < a * 2; i += 2) {
    if (n > m) res[i] = 0, res[i + 1] = 1;else res[i] = 1, res[i + 1] = 0;
  }
  n -= a;
  m -= a;
  if (n) {
    while (n--) {
      res.push(0);
    }
  } else if (m) {
    while (m--) {
      res.push(1);
    }
  }
  return res.join('');
}

async function main(read) {
  try {
    let t = Number(await read());
    let res = new Array(t);
    for (let i = 0; i < t; i++) {
      const [n, m] = (await read()).split(' ').map(Number);
      res[i] = solve(n, m);
    }
    return res.join('\n');
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', async () => {
  inputs = str.split('\n').values();
  const output = await main(read);
  process.stdout.write(output);
});

//@ts-check
/**
 * Author : Fazlul Hoque
 * Node.js version : 12.16.3
 * command : node fileName.js <input.txt >output.txt
 */
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = ""; //An array of  raw inputs (includes 'n,\r , not usable. need to process before use)
let currentLine = 0; //input sequence controller variable.

process.stdin.on("data", (inputStdin) => {
    inputString += inputStdin;
});
process.stdin.on("end", () => {
    inputString = inputString.split("\n");
    main(); // after input
});

/********** Utility Functions Start **********/
/**
 *  read row Input
 * @returns string
 */
function _readRawLine() {
    return inputString[currentLine++];
}
function readLine() {
    // return _readRawLine().replace(/\s+$/g, '');
    return _readRawLine().replace("\r", "");
}

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

function readSingleInt() {
    const p = readLine();
    return parseInt(p);
}

function readIntArray() {
    return readLine()
        .split(" ")
        .map((v) => parseInt(v));
}

function readArray() {
    return readLine().split(" ");
}

function int(n) {
    return parseInt(n);
}
/********** Utility Functions End **********/
/**
 * Don't Touch this fucntion at all , unless you know what are you doing!
 */
function main() {
    solve();
}

// ********** actual Code Starts from here **********

function add(   a   ,b){
    let k = a+b;
    return k;
}

function solve() {
    let t = readSingleInt();
    const boundary = `**********`;
    while (t--) {
        let [a,b] = readIntArray();

        let d = Math.min(a,b);
        let ans ='';
        for(let i=0;i<d;i++){
            ans+="01";
        }
        let chr ;
        if(a>b){
            chr='0';
        }else{
            chr='1'
        }
        for(let i=0;i<Math.abs(a-b);i++){
            ans+=chr;
        }
       console.log(ans)
    }

}

'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 output(x) {
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let i = 0; i < N; i++) {
        let [zeros, ones] = readline().split(' ');

        let min = Math.min(zeros, ones);
        let max = Math.max(zeros, ones);
        let diff = max - min;
        let moreOf = zeros > ones ? '0': '1';

        let result = ('01').repeat(min);
        result += moreOf.repeat(diff);

        output(result);
    }
}

'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 output(x) {
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let i = 0; i < N; i++) {
        let [zeros, ones] = readline().split(' ');

        let min = Math.min(zeros, ones);
        let max = Math.max(zeros, ones);
        let diff = max - min;
        let base = zeros > ones ? '01' : '10';
        let moreOf = zeros > ones ? '0': '1';

        let result = base.repeat(min);
        result += moreOf.repeat(diff);

        output(result);
    }
}

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
	var t = lines[0];
    var k = lines[1].split('');
	var cnt = 0;
	var ans = '';
	var a = new Array(10);
	for(i = 0; i < 10; i++){
	    a[i] = 0;
	}
	for(i = 0; i < t; i++){
        if(k[i] == 'L'){
            cnt = 0;
            for(j = 0; j < 10; j++){
                if(a[j] === 0){
                    cnt++;
                    a[j] = 1;
                }
                if(cnt == 1){
                    break;
                }
            }
        }else if(k[i] =='R'){
            cnt = 0;
            for(j = 9; j >= 0; j--){
                if(a[j] === 0){
                    cnt++;
                    a[j] = 1;
                }
                if(cnt == 1){
                    break;
                }
            }
        }else{
            a[k[i]] = 0;
        }
	}
	for(i = 0; i < 10; i++){
	    ans += a[i];
	}
	console.log(ans);
});

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\r\n');
let currentline = 0;
function readline(){
      return input[currentline++];
}
var T = readline();
for(var qe=1;qe<=T;qe++) {
  //var n = readline()//.split(' ').map((x) => parseInt(x));
  var [a, b] = readline().split(' ').map((x) => parseInt(x));
  var ans = '';
  if(a>=b){
       for(var i=0;i<b;i++){
            ans+="01";
       }
       for(var i=0;i<a-b;i++){
            ans+="0";
       }
  }
  else{
        for(var i=0;i<a;i++){
            ans+="10";
       }
       for(var i=0;i<a-b;i++){
            ans+="1";
       }
  }

  console.log(ans)

}

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

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

function main() {
  var t = parseInt(readline())

  while(t--){
    var s = readline()
    var x = s.split(' ')
    var a = parseInt(x[0])
    var b = parseInt(x[1])
    var str = ''
    while(a--) str+='0'
    while(b--) str+='1'
    console.log(str)
  }

}

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\r\n');
let currentline = 0;
function readline(){
      return input[currentline++];
}

function alph() {
  var f = 'abcdefghijklmnopqrstuvwxyz';
  return f;
}
function Alph() {
  var f = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  return f;
}
function max(x,y) {
  return x >=y ? x : y;
}
function min(x,y) {
  return x <=y ? x : y;
}
function abs(x) {
  return x < 0 ? x*(-1) : x;
}

var T = readline();
for(var qe=1;qe<=T;qe++) {
  //var n = readline()//.split(' ').map((x) => parseInt(x));
  var [a, b] = readline().split(' ').map((x) => parseInt(x));
  var ans = '';
  var i = a, j = b;
  var iNext = false, jNext = true;
  while(i>0 || j>0) {
    if(iNext || j == 0) {
      ans += 0
      jNext = true;
      iNext = false;
      i--
      continue;
    }
    if(jNext || i == 0) {
      ans += 1
      j--
      jNext = false;
      iNext = true
    }
  }

  console.log(ans)
  //fs.appendFileSync('output.txt', ans+'\r\n');

}
//