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

rl.on('line', (d) => {
  const str = d.slice(1, d.length - 1);

  if (str.length === 0) {
    console.log(0);
    return;
  }

  const data = str.split(', ');
  const ans = new Set(data).size;

  console.log(ans);
});

var input = readline();

if (input.length === 2) {
    print(0);
} else {
    var val = input.slice(1, input.length - 1).split(", ");

    var se = new Set();

    for (var i = 0; i < val.length; i++) {
        se.add(val[i]);
    }

    print(se.size);
}

const regExp = /[{} ]/g;
var modifiedPlentyToArray = readline().replace(regExp, "").split(',');
if (modifiedPlentyToArray[0]){
    var newSet = new Set(modifiedPlentyToArray);
    print(newSet.size);
} else {
    print(0);
}

if (!this.readline) print = console.log, readline = require('./readline');

var m = {};
var a = readline();

for (var i = 0; i < a.length; i++) {
  if (a[i] != '{' && a[i] != '}' && a[i] != ',' && a[i] != ' ') {
    m[a[i]] = 1;
  }
}

print(Object.keys(m).length);

var letters = readline().split(""), unique = [];
letters.pop();
letters.shift();
letters = letters.join("").split(", ");

for(i = 0; i < letters.length; i++){
	if( letters[0].length == 0 ){
		unique.length = 0;
		break;
	}
	if(i == 0){
		unique.push(letters[i]);
		continue;
	}
	if( unique.every(function(a){ return (a != letters[i]) ? true : false }) ){
		unique.push(letters[i]);
	}
}
write(unique.length);

var input = readline();
input = input.slice(1, input.length - 1);
if (input == '') {
    print(0);
} else {
    input = input.split(', ');
    var unique = {};

    for (var i = 0; i < input.length; i++) {
        unique[input[i]] = true;
    }
    print(Object.keys(unique).length);
}

var s = readline();
s = s.slice(1, s.length - 1).split(/\s*,\s*/);
var used = {};
var answer = 0;

for (var i = 0; i < s.length; i++) {
	if (s[i].length === 1 && !used.hasOwnProperty(s[i])) {
		answer++;
		used[s[i]] = null;
	}
}

print(answer);

var s = readline();
s = s.slice(1, s.length - 1).split(/\s*,\s*/);
var used = {};
var answer = 0;

for (var i = 0; i < s.length; i++) {
	if (s[i].length === 1 && used[s[i]] === undefined) {
		answer++;
		used[s[i]] = null;
	}
}

print(answer);

var input = readline();
var arr = [];
for (var i = 1; i < input.length; i+=3) {
    if (input.charAt(i) != "{" || input.charAt(i) != "}") {
        var checker = false;
        for (var j = 0; j < arr.length; j++) {
            if (input.charAt(i) == arr[j]) {
                checker = true;
            }
        }
        if (checker == false) {
            arr.push(input.charAt(i));
        }
    }
}
if (input.length < 3) {
    print(0);
}
else {
    print(arr.length);
}

const readline = require('readline');

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

rl.on('line', function(line){
    const set = new Set(line.replace(/{|}/g, '').split(',').map(e => e.trim()).filter(e => e.length));
    console.log(set.size);
});

print(readline().trim().split(/[, {}]+/).sort().splice(2).map(function(x,i,a){ return a.indexOf(x) == i ? 1: 0}).reduce(function(a,b) {return a+b}, 0));

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

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

readline.on('close', () => {
    if (input[0] === '{}') { console.log(0); process.exit(); }
    const n = new Set(input[0].slice(1, -1).split(' ').map(v => v[0]));
    console.log(n.size);
});

function onlyUnique(value, index, self) {
    return self.indexOf(value) === index;
}

function trimMap(el) {

    return el.trim();
}

var levels = readline();

if (levels == '{}') print(0);
else {

    levels = levels.slice(0, -1)
                   .substr(1)
                   .split(',')
                   .map(trimMap)
                   .filter(onlyUnique);

    print(levels.length);
}

var string = readline()

  var arr = new Array('z'.charCodeAt(0) - 'a'.charCodeAt(0)).fill(0)
  for (var i = 0; i < string.length; i++) {
    if (string[i] !== '{' && string[i] !== ' ' && string[i] !== ',' && string[i] !== '}') {
      arr[string.charCodeAt(i) - 'a'.charCodeAt(0)] += 1
    }
  }

  var count = 0
  for (var i = 0; i < arr.length; i++) {
    if (arr[i] !== 0) {
      count += 1
    }
  }

  print(count)

let fs = require('fs');

let txt = fs.readFileSync(0, "utf-8").split(/[\n\r]/).filter(data => data.length > 0);

for (let i = 0; i < txt.length; i++) {
    doit(txt[i].split(/[{}, ]/).filter(data => data.length > 0));
}

function doit(tab) {
    console.log([...new Set(tab)].length);
}

//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 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 s = next().replace("{", "").replace("}", "").replace(/ /g, "").split(",");
  if(s[0] == ""){
    myout(0);
  }else{
    myout(new Set(s).size);
  }

}

// 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 inputs = str.replace(/[{()}\s+]/g, '').trim();
    let distinctLetters = inputs !== '' ? [...new Set(inputs.split(','))].length : 0;
    return distinctLetters.toString();
}

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

const input = [];
readLine.on('line', line => input.push(line));
const anton = () => {
    if (input[0] === '{}') {
        console.log(0);
    }
    else {
        let s = input[0].slice(1, -1);
        let ar = s.split(', ');
        let ar2 = new Set(ar);
        console.log(ar2.size);
    }
};

readLine.on('close', anton);

const readline = require('readline');

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

// Read Inputs
rl.on('line', set => {
    const letters = set.split(/\W/).filter(letter => letter != '');

    check(letters)
})

function check(letters) {
    let counter = 1;

    if (letters.length == 0)
        return console.log(0)

    letters.sort((a, b) => {
        return a > b ? 1 : -1
    }).reduce((prev, curr) => {
        if (prev != curr)
            counter++;
        return curr
    })

    return console.log(counter)
}

'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 count(s) {
    let c = 0;
    for (var i = 0; i < s.length; i++) {
        if (s.indexOf(s[i]) == i) {
            c++
        }
    }
    return c;
}

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

function main() {
    let s = readLine().replace(/[{}, ]/g, '');
    console.log(count(s));
}

var input = readline();
var count = [];
for(var i= 0; i< input.length; i++){
    if(input.charCodeAt(i) >=97 && input.charCodeAt(i) <=122 && !count.includes(input[i]))count.push(input[i]);
}
print(count.length);

;(function () {
	print( readline().split('').filter(function (e) { return /\w+/.test(e); }).filter(function (e, i, a) { return i == a.lastIndexOf(e); }).length );
}).call(this)

var input = readline().slice(1, -1);
write(input ? new Set(input.split(', ')).size : 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 print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // input
  const line = readline();
  const a = line.slice(1, line.length - 1)
    .split(',')
    .map(x => x.trim())
    .filter(x => x !== '');
  const s = new Set();
  for (let i = 0; i < a.length; i++) {
    s.add(a[i]);
  }
  // output
  print(s.size);
}

'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 readint() {
    let line = readline().split(' ').map(function(num) {
        return parseInt(num);
    });
    return line;
}

function readfloat() {
    let line = readline().split(' ').map(function(num) {
        return parseFloat(num);
    });
    return line;
}

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

function write(x) {
    process.stdout.write(x);
}
function main() {
    let a = readline();
    let set = new Set();
    if(a.length < 3) {
        print("0");
        return;
    }
    for (let i = 1; i < a.length; i+=3) {
        const element = a[i];
        set.add(element);
    }

    print(set.size);

}

const input = [];

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

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

RL.on('close', () => {
  const line = input[0];
  const set = new Set();
  for (let i = 0; i < line.length; i += 1) {
    if (line[i] !== '{' && line[i] !== '}' && line[i] !== ' ' && line[i] !== ',')
      set.add(line[i]);
  }

  console.log(set.size);
});

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], 10);
	};
	return tokens;
}

function main() {
	var s = trim(readline());
	s = s.substring(1, s.length-1);
	var tokens = s.split(','),
		count = 0, hash = {};
	for (var i = 0; i < tokens.length; ++i) {
		var token = trim(tokens[i]);
		if (token.length == 0) {
			continue;
		}
		if (hash[token] === undefined) {
			++count;
			hash[token] = true;
		}
	}
	print(count);
}

main();

var s = readline();
var arr = s.substring(1, s.length-1).split(", ");
var obj = {};
for(var i =0; i<arr.length; i++) {
    if (arr[i]!=='')
        obj[arr[i]] = true;
}
print(Object.keys(obj).length);

(function() {
    'use strict';
    let n = readline();
    let x = /\w+/g;
    let y = new Set(n.match(x)).size;
    print(y);
}());

var toObject = x => {
    var y = {};
    y[x] = true;
    return y;
    // {`${x}`: true}
};
var toKeyMap = (a, b) => (Object.assign(a, b));

var noise = '{, }'.split('').map(toObject).reduce(toKeyMap);
var noiseFilter = x => (!noise[x]);

var ar = readline().split('').filter(noiseFilter).map(toObject);

print(
    ar.length > 0 ?
        Object.keys(ar.reduce(toKeyMap)).length
        : 0
);

'use strict';
const obj = {};
readline()
  .replace('}', '')
  .replace('{', '')
  .split(',')
  .forEach((letter) => {
    letter = letter.trim();
    if (letter.length) obj[letter] = 1;
  });

write(Object.keys(obj).length);

var s = readline();
s = s.replace("}", "");
s = s.replace("{", "");
var a = [];
a = s.split(", ");
var res = 0;
for(i = 0; i < a.length; i++){
    if(a.indexOf(a[i]) == i){
        res++;
    }
}
if(s == ""){
    res = 0;
}
print(res);

var n = readline().slice(1,-1).replace(/, /g, "").split("");
var s = new Set(n).size;
print(s);

var values = readline()
var set = new Set(values.split(/[\{\}\, ]/g))
if(set.size == 0)
    print(0)
else
    print(set.size - 1)

var input = readline();
input = input.slice(1, input.length-1);
var array = input.split(", ");
var k=0;
var bArr = {};
for (i=0; i<array.length; ++i) {
if (bArr[array[i]] === undefined && array[i].length > 0){
++k;
bArr[array[i]] = "*";
}

}
print(k);

var main = function(str)
{
    if (str === '{}') return 0;
	var obj = {},
	sum = 0,
    arr  = str.split(', ');
	arr[0] = arr[0][1];
	arr[arr.length - 1] = arr[arr.length - 1][0];
	arr = arr.sort();

	for (var i = 0; i <= arr.length - 1; i++)
	{
		if (typeof(obj[arr[i]]) === 'number') obj[arr[i]]++;
		else {
			obj[arr[i]] = 1;
			sum++;
		}
	}
	return sum;
}
var input = readline();
print(main(input));

var input = readline().slice(1, -1);
if (input.length === 0)
	print(0);
else
	print(input.split(", ")
	.reduce(function(set, value) {
		if (set.indexOf(value) === -1)
			set.push(value);
		return set;
	}, [])
	.length);

var line = readline();

var alphabet = [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];
var distinct = 0;

for(i=0;i<line.length;i++){
    if(line.charCodeAt(i)<97 || line.charCodeAt(i)>122){
	continue;
    }else {
	alphabet[line.charCodeAt(i)-97]+=1;
    }
}

for(i=0;i<26;i++){
    if(alphabet[i]>0){
	distinct+=1;
    }
}

print(distinct);

var line = readline();

var alphabet = [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];
var distinct = 0;

for(i=0;i<line.length;i++){
    if(line.charCodeAt(i)-97<27){
	alphabet[line.charCodeAt(i)-97]+=1;
    }
}

for(i=0;i<26;i++){
    if(alphabet[i]>0){
	distinct+=1;
    }
}

print(distinct);

var input = readline().slice(1, -1);
write(input ? new Set(input.split(', ')).size : 0);

function main(str) {
  var setArr = [];
  var clearStr = str ? str.slice(1, -1) : '';
  if (clearStr) {
    var arr = clearStr.split(', ');
    arr.sort();
    var i = 0;
    for (i; i < arr.length; i++) {
      if (setArr[setArr.length - 1] !== arr[i]) {
        setArr.push(arr[i]);
      }
    }
  }
  write(setArr.length);
}
var data = readline();
main(data);

var letters = readline().split("");
var set = new Set(letters);
set.delete("{");
set.delete(",");
set.delete("}");
set.delete(" ");
print(set.size)

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 = new Set(input[0].slice(1, -1).split(' ').map(v => v[0]));
    console.log(n.size);
});

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 = new Set(input[0].slice(1, -1).split(' '));
    console.log(n.size);
});

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

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

readline.on('close', () => {
    if (input[0] = '{}') { console.log(0); process.exit(); }
    const n = new Set(input[0].slice(1, -1).split(' ').map(v => v[0]));
    console.log(n.size);
});

let fs = require('fs');

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

function doit(tab) {
    console.log([...new Set(tab)].length);
}

const readline = require('readline');

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

// Read Inputs
rl.on('line', set => {
    const letters = set.split(/\W/).filter(letter => letter != '');

    check(letters)
})

function check(letters) {
    let counter = 1;

    if (letters.length == 0)
        return console.log(0)

    let sorted = letters.sort((a, b) => a > b)

    sorted.reduce((prev, curr) => {
        if (prev != curr)
            counter++;
        return curr
    })

    if (counter > 26)
        return console.log(26)
    else
        return console.log(counter)
}

const readline = require('readline');

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

// Read Inputs
rl.on('line', set => {
    const letters = set.split(/\W/).filter(letter => letter != '');
    check(letters)
})

function check(letters) {
    let counter = letters.length;

    if (counter == 0)
        return console.log(counter)

    letters.sort((a, b) => a > b).reduce((prev, curr) => {
        if (prev == curr)
            counter--;
        return curr
    })

    console.log(counter)
}

const readline = require('readline');

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

// Read Inputs
rl.on('line', set => {
    const letters = set.split(/\W/).filter(letter => letter != '');

    check(letters)
})

function check(letters) {
    let counter = 1;

    if (letters.length == 0)
        return console.log(0)

    let sorted = letters.sort((a, b) => a > b)

    sorted.reduce((prev, curr) => {
        if (prev != curr)
            counter++;
        return curr
    })

    return console.log(counter)
}

const readline = require('readline');

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

// Read Inputs
rl.on('line', set => {
    const letters = set.split(/\W/).filter(letter => letter != '');
    check(letters)
})

function check(letters) {
    let counter = letters.length;

    if (counter == 0)
        return console.log(counter)

    letters.sort((a, b) => a < b).reduce((prev, curr) => {
        if (prev == curr)
            counter--;
        return curr
    })

    return console.log(counter)
}

const readline = require('readline');

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

// Read Inputs
rl.on('line', set => {
    const letters = set.split(/\W/).filter(letter => letter != '');

    check(letters)
})

function check(letters) {
    let counter = 1;

    if (letters.length == 0)
        return console.log(0)

    let sorted = letters.sort((a, b) => a > b)

    console.log(sorted);

    sorted.reduce((prev, curr) => {
        if (prev != curr)
            counter++;
        return curr
    })

    return console.log(counter)
}

const readline = require('readline');

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

// Read Inputs
rl.on('line', set => {
    const letters = set.split(/\W/).filter(letter => letter != '');

    check(letters)
})

function check(letters) {
    let counter = 1;

    if (letters.length == 0)
        return console.log(0)

    let sorted = letters.sort((a, b) => a > b)

    sorted.reduce((prev, curr) => {
        if (prev != curr)
            counter++;

        if (counter > 26)
            return console.log(counter)

        return curr
    })

    return console.log(counter)
}

const readline = require('readline');

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

rl.on('line', function(line){
    const set = new Set(line.replace(/{|}/g, '').split(',').map(e => e.trim()));
    console.log(set.size);
});

var letters = readline().split(""), unique = [];
letters.pop();
letters.shift();
letters = letters.join("").split(", ");

for(i = 0; i < letters.length; i++){
	if( !!letters ){
		unique.length = 0;
		break;
	}
	if(i == 0){
		unique.push(letters[i]);
		continue;
	}
	if( unique.every(function(a){ return (a != letters[i]) ? true : false }) ){
		unique.push(letters[i]);
	}
}
write(unique.length);

var input = readline();
input = input.slice(1, input.length - 1).split(', ');
var unique = {};
for (var i = 0; i < input.length; i++) {
    unique[input[i]] = true;
}
print(Object.keys(unique).length);

var s = readline();
s = s.slice(1, s.length - 1).split(/\s+,\s+/);
var used = {};
var answer = 0;

for (var i = 0; i < s.length; i++) {
	print(s[i]);
	print(s[i].length);
	print(used[s[i]]);
	if (s[i].length === 1 && used.hasOwnProperty(s[i])) {
		answer++;
		used[s[i]] = null;
	}
}

print(answer);

var s = readline();
s = s.slice(1, s.length - 1).split(/\s+,\s+/);
var used = {};
var answer = 0;

for (var i = 0; i < s.length; i++) {
	if (s[i].length === 1 && used[s[i]] === undefined) {
		answer++;
		used[s[i]] = null;
	}
}

print(answer);

var s = readline();
s = s.slice(1, s.length - 1).split(/\s+,\s+/);
var used = {};
var answer = 0;

print(s)
print(used)

for (var i = 0; i < s.length; i++) {

	if (s[i].length === 1 && used[s[i]] === undefined) {
		answer++;
		used[s[i]] = null;
	}
}

print(answer);

var s = readline();
s = s.slice(1, s.length - 1).split(/\s*,\s*/);
var used = {};
var answer = 0;

for (var i = 0; i < s.length; i++) {
	print(s[i]);
	print(s[i].length);
	print(used[s[i]]);
	if (s[i].length === 1 && !used.hasOwnProperty(s[i])) {
		answer++;
		used[s[i]] = null;
	}
}

print(answer);

var input = readline();
var arr = [];
for (var i = 1; i < input.length; i+=3) {
    if (input.charAt(i) != "{" || input.charAt(i) != "," || input.charAt(i) != " " || input.charAt(i) != "}") {
        var checker = false;
        for (var j = 0; j < arr.length; j++) {
            if (input.charAt(i) == arr[j]) {
                checker = true;
            }
        }
        if (checker == false) {
            arr.push(input.charAt(i));
        }
    }
}
print(arr.length);

var input = readline().split("");
var count = [];
for(var e of input){
    if(e == '}' && e == '{' && !cout.includes(e))count.push(e);
}
print(count.length);

var s = readline();
var arr = s.substring(1, s.length-1).split(", ");
var obj = {};
for(var i =0; i<arr.length; i++) {
    obj[arr[i]] = true;
}
print(Object.keys(obj).length);

var s = readline();
var arr = s.substring(1, -1).split(", ");
var obj = {};
for(var i =0; i<arr.length; i++) {
    obj[arr[i]] = true;
}
print(Object.keys(obj).length);

'use strict';
const obj = {};
readline()
  .replace('}', '')
  .replace('{', '')
  .split(',')
  .map(letter => obj[letter.trim()] = 1);

write(Object.keys(obj).length);

'use strict';
const obj = {};
readline()
  .replace('}', '')
  .replace('{', '')
  .replace(' ', '')
  .split(',')
  .map(letter => obj[letter] = 1);

write(Object.keys(obj).length);

var s = readline();
s = s.replace("}", "");
s = s.replace("{", "");
var a = [];
a = s.split(", ");
var res = 0;
for(i = 0; i < a.length; i++){
    if(a.indexOf(a[i]) == i){
        res++;
    }
}
print(res);

var s = readline();
s = s.replace("}", "");
s = s.replace("{", "");
var a = [];
a = s.split(", ");
var res = 0;
for(i = 0; i < a.length; i++){
    if(a.indexOf(a[i]) == i){
        res++;
    }
}
if(a.length == 0){
    res++;
}
print(res);

var n = readline().slice(1,-1);
var s = new Set(n.split(", ")).size;
print(s);

var input = readline();
input = input.slice(1, input.length-1);
var array = input.split(", ");
var k=0;
var bArr = {};
for (i=0; i<array.length; ++i) {
if (bArr[array[i]] === undefined && bArr[array[i] !== ""]){
++k;
bArr[array[i]] = "*";
}

}
print(k);

var input = readline();
input = input.slice(1, input.length-1);
var array = input.split(", ");
var k=0;
var bArr = {};
for (i=0; i<array.length; ++i) {
if (bArr[array[i]] === undefined){
++k;
bArr[array[i]] = "*";
}

}
print(k);

var main = function(str)
{
	var revoke = 0,
	count = 0,
    arr  = str.split(', ');
	arr[0] = arr[0][1];
	arr[arr.length - 1] = arr[arr.length - 1][0];
	arr = arr.sort();
	for (var i = 1; i <= arr.length - 1; i++)
	{
		if ((arr[i] !== arr[i - 1]) && (i === 1)) count += 2;
		else
		{
			if ((arr[i] !== arr[i - 1])) count++;
		}
	}
	return count;
}
var input = readline();
print(main(input));

var main = function(str)
{
	var obj = {},
	sum = 0,
    arr  = str.split(', ');
	arr[0] = arr[0][1];
	arr[arr.length - 1] = arr[arr.length - 1][0];
	arr = arr.sort();
	for (var i = 0; i <= arr.length - 1; i++)
	{
		if (typeof(obj[arr[i]]) === 'number') obj[arr[i]]++;
		else {
			obj[arr[i]] = 1;
			sum++;
		}
	}
	return sum;
}
var input = readline();
print(main(input));

write(new Set(readline().slice(1, -1).split(', ')).size);

function main(str) {
  var setArr = [];
  var clearStr = str ? str.slice(1, -1) : '';
  write('clearStr: ' + clearStr);
  if (clearStr) {
    var arr = clearStr.split(', ');
    arr.sort();
    var i = 0;
    for (i; i < arr.length; i++) {
      if (setArr[setArr.length - 1] !== arr[i]) {
        setArr.push(arr[i]);
      }
    }
  }
  write(setArr.length);
}
var data = readline();
print('data: ' + data);
main(data);

var letters = readline().split("");
var set = new Set(letters);
print(set.size-4)

var letters = readline().split("");
var set = new Set(letters);
print(set.size-3)

var letters = readline().split("");
var set = new Set(letters);
print(set)
print(set.size-3)

var input = readline();
var val = input.slice(1, input.length - 1).split(", ");

var se = new Set();

for (var i = 0; i < val.length; i++) {
    se.add(val[i]);
}

print(se.size);


var t = parseInt(readline());

function div(val, by){
    return (val - val % by) / by;
}

function setCharAt(str,index,chr) {
    if(index > str.length-1) return str;
    return str.substr(0,index) + chr + str.substr(index+1);
}

var ch = 'a';
var acode = ch.charCodeAt(0);

for (var tt = 0; tt < t; tt++) {
    var n = parseInt(readline());
    var a = readline().split(' ').map(Number);
    var m = {};
    for (var i = 0; i < n; i++) {
        m[a[i]] = m[a[i]] ? m[a[i]] + 1 : 1;
    }
    var nums = Object.keys(m).map(Number);
    var res = 1;
    for (var i = 0; i < nums.length; i++) {
        var num = nums[i];
        var l = 0;
        var r = n - 1;
        var mcopy = Object.assign({}, m);
        var locallen = 0;
        while (l < r) {
            while (l < n && a[l] != num) {
                mcopy[a[l]] -= 1;
                l += 1;
            }
            while (r >= 0 && a[r] != num) {
                mcopy[a[r]] -= 1;
                r -= 1;
            }
            if (l >= r) {
                break;
            }
            mcopy[a[l]] -= 1;
            l += 1;
            mcopy[a[r]] -= 1;
            r -= 1;
            locallen += 2;
            var localmax = 0;
            var mcopykeys = Object.keys(mcopy);
            for (var j = 0; j < mcopykeys.length; j++) {
                var localkey = mcopykeys[j];
                if (mcopy[localkey] > localmax) {
                    localmax = mcopy[localkey];
                }
            }

            if (locallen + localmax > res) {
                res = locallen + localmax;
            }
        }
    }

    write(res+'\n');
}

'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(){
	var tt = parseInt(readline());
	while(tt--){
		var n = parseInt(readline());
		var a = readline().split(" ").map(function(x){ return parseInt(x) - 1;});
		var pre = [];
		var fix = [];
		var M = 200;
		var ans = 0;
		for(var i = 0; i < M; i++){
			pre[i] = [], fix[i] = [];
			pre[i][0] = 0;
			for(var j = 0; j < n; j++){
				pre[i][j + 1] = pre[i][j] + (a[j] == i);
				if(a[j] == i){
					fix[i].push(j);
				}
			}
		}
		for(var x = 0; x < M; x++){
			var u = pre[x][n];
			ans = Math.max(ans, u);
			for(var c = 1; 2 * c <= u; c++){
				var l = fix[x][c - 1];
				var r = fix[x][u - c];
				for(var y = 0; y < M; y++){
					if(x != y)
						ans = Math.max(ans, 2 * c + pre[y][r] - pre[y][l]);
				}
			}
		}
		console.log(ans);
	}
}


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

let n = (m = remainingLines = remainingTestCount = lineNumber = lineCount = 0);

// Some utitls
const utils = {};
utils.doOnTestInputFinished = (line) => {
  line = line.split('');

  const DB = {};
  let position = [0, 0];
  let preparedPosition = utils.preparePosition(position);
  DB[preparedPosition] = [0];

  let answer = -1;
  let arrayLength;
  // Make it as much big as we can
  let minLength = Infinity;

  for (let letterIndex in line) {
    let letter = line[letterIndex];
    let preparedIndex = Number(letterIndex) + 1;

    position = utils.determineNextPosition(position, letter);
    preparedPosition = utils.preparePosition(position);

    if (preparedPosition in DB) {
      arrayLength = DB[preparedPosition].length;
      lastIndex = DB[preparedPosition][arrayLength - 1];

      if (preparedIndex - lastIndex < minLength) {
        minLength = preparedIndex - lastIndex;
        answer = `${lastIndex + 1} ${preparedIndex}`;
      }

      DB[preparedPosition].push(preparedIndex);
    } else {
      DB[preparedPosition] = [preparedIndex];
    }
  }

  console.log(answer);
  // console.log('DB', DB);
};
utils.preparePosition = (position) => {
  return `${position[0]} ${position[1]}`;
};
utils.determineNextPosition = (position, letter) => {
  switch (letter) {
    case 'U':
      return [position[0], position[1] + 1];
    case 'D':
      return [position[0], position[1] - 1];
    case 'R':
      return [position[0] + 1, position[1]];
    case 'L':
      return [position[0] - 1, position[1]];
  }
  return position;
};

rl.on('line', async (line) => {
  try {
    lineNumber++;
    if (lineNumber === 1) {
      // First Line
      remainingTestCount = Number(line);
      return;
    }
    if (!remainingLines) {
      // First line of each test case
      [n, m] = line.split(' ').map((d) => Number(d));
      remainingLines = 1;
      remainingTestCount--;
      return;
    }

    remainingLines--;
    if (remainingLines === 0) {
      // Do something on after inputs of each test case
      utils.doOnTestInputFinished(line);
    }
  } catch (e) {
    console.log(e.message);
    console.log(e.stack);
  }
});

// const SegmentTree = require('javascript-algo-ds/src/data-structure/trees/segmentTree/segmentTree')
process.stdin.resume()
process.stdin.setEncoding('utf-8')

let input = ''
let ptr = 0
process.stdin.on('data', (i) => {
  input += i
})

process.stdin.on('end', () => {
  input = input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt() {
  return parseInt(input[ptr++])
}

function readString() {
  return input[ptr++]
}

function readStrings() {
  return input[ptr++].split(' ')
}

function readInts() {
  return input[ptr++].split(' ').map(a => parseInt(a))
}

function main() {
  let t = readInt()
  while(t--) {
    const n = readInt()
    const s = readString()
    let x = 0, y = 0
    let map = {}
    map[tS(0, 0)] = -1
    let max = [Infinity, -1, -1]
    for(let i = 0; i < n; i++) {
      switch (s[i]) {
        case 'L' : x--; break
        case 'R' : x++; break
        case 'D' : y--; break
        case 'U' : y++; break
      }
      let str = tS(x, y)
      if(map[str] !== undefined) {
        // wr(map, str, i)
        if(i - map[str] < max[0]) {
          max[0] = i - map[str]
          max[1] = map[str]
          max[2] = i
        }
        map[str] = i
      }
      else {
        map[str] = i
      }
    }
    if(max[0] === Infinity) wr(-1)
    else {
      wr(tS(max[1] + 2, max[2] + 1))
    }
  }

  function tS(x, y) {
    return `${x} ${y}`
  }
}

const processData = (lines) => {
  const num = +lines[0]

  for (let i = 0; i<num; i++) {
    const data = lines[i*2 + 2].split('')
    const points = {
      ['0_0']: [0]
    }
    let curPos = {
      x: 0,
      y: 0,
    }
    let index = 1
    for (const d of data) {
      switch(d) {
        case 'L':
          curPos.x = curPos.x - 1
          break;
        case 'R':
          curPos.x = curPos.x + 1
          break;
        case 'U':
          curPos.y = curPos.y + 1
          break;
        case 'D':
          curPos.y = curPos.y - 1
          break;
      }
      const hash = `${curPos.x}_${curPos.y}`

      if (!points[hash])
        points[hash] = [index]
      else
        points[hash].push(index)

      index++
    }

    let min = -1
    let choosingPoint = null
    for (const point in points) {
      if (points[point].length > 1) {
        for (let j=0; j<points[point].length+1; j++) {
          const len = points[point][j+1] - points[point][j]
          if (min === -1) {
            min = len
            choosingPoint= [points[point][j], points[point][j+1]]
          }
          if (len < min) {
            min = len
            choosingPoint= [points[point][j], points[point][j+1]]
          }
        }
      }
    }
    if (min === -1) {
      console.log('-1')
    } else {
      console.log(`${choosingPoint[0]+1} ${choosingPoint[1]}`)
    }
  }
}

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*/
  processData(lines)
})

'use strict'

const problem = (n, s) => {
    const v = { '0.0': [ -1 ] };
    let x = 0;
    let y = 0;
    for(let i = 0; i < n; i++) {
        if (s[i] === 'L') x--;
        else if (s[i] === 'R') x++;
        else if (s[i] === 'U') y++;
        else if (s[i] === 'D') y--;
        const j = `${x}.${y}`;
        if (v[j]) v[j].push(i);
        else v[j] = [i];
    }
    const values = Object.keys(v).map(i => v[i]).filter(i => i.length > 1);
    let min = Infinity;
    let value;
    for (let i = 0; i < values.length; i++) {
        for (let j = 1, d; j < values[i].length; j++) {
            d = values[i][j] - values[i][j-1];
            if (d < min) { min = d; value = [ values[i][j-1], values[i][j] ] }
        }
    }
    return value ? `${value[0]+2} ${value[1]+1}` : -1;
}

let t = +readline();
while(t--) print(problem(+readline(), readline()));

'use strict'

let t = parseInt(readline())
while (t --> 0) {
  const n = parseInt(readline())
  const path = readline()
  let x = 0
  let y = 0
  let last = 0
  let found = false
  const visited = {
    [x + ',' + y]: 0
  }

  let ans = 1e9
  for (let i = 0; i < n; ++i) {
    if (path[i] === 'L') {
      x --
    } else if (path[i] === 'R') {
      x ++
    } else if (path[i] === 'U') {
      y ++
    } else {
      y --
    }
    const next = x + ',' + y

    if (Object.hasOwnProperty.call(visited, next)) {
      found = true
      const len = i - visited[next]
      if (len < ans) {
        ans = len
        last = i
      }
    }
    visited[next] = i+1
  }

  if (!found) print(-1)
  else {
    print(last - ans + 1, last + 1)
  }
}

// const SegmentTree = require('javascript-algo-ds/src/data-structure/trees/segmentTree/segmentTree')
process.stdin.resume()
process.stdin.setEncoding('utf-8')

let input = ''
let ptr = 0
process.stdin.on('data', (i) => {
  input += i
})

process.stdin.on('end', () => {
  input = input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt() {
  return parseInt(input[ptr++])
}

function readString() {
  return input[ptr++]
}

function readStrings() {
  return input[ptr++].split(' ')
}

function readInts() {
  return input[ptr++].split(' ').map(a => parseInt(a))
}

function main() {
  let t = readInt()
  while(t--) {
    const n = readInt()
    const s = readString()
    let x = 0, y = 0
    let map = {}
    map[tS(0, 0)] = -1
    let max = [Infinity, -1, -1]
    for(let i = 0; i < n; i++) {
      switch (s[i]) {
        case 'L' : x--; break
        case 'R' : x++; break
        case 'D' : y--; break
        case 'U' : y++; break
      }
      let str = tS(x, y)
      if(map[str] !== undefined) {
        if(i - map[str] < max[0]) {
          max[0] = i - map[str]
          max[1] = map[str]
          max[2] = i
        }
      }
      else {
        map[str] = i
      }
    }
    if(max[0] === Infinity) wr(-1)
    else {
      wr(tS(max[1] + 2, max[2] + 1))
    }
  }

  function tS(x, y) {
    return `${x} ${y}`
  }
}


var n = readline();
var a = readline();
var ro =0,re=0,bo=0,be=0;
for (var i=0;i<a.length;i++) {
    if (i % 2 === 0) {
        if (a[i] === "r") {
            re++;
        }
        else {
            be++;
        }
    } else {
        if (a[i] === "r") {
            ro++;
        }
        else {
            bo++;
        }
    }
}
var m1 = Math.max(ro,be);
var m2 = Math.max(re,bo);
print(Math.min(m1,m2));

var n = readline();
var a = readline();
var ro=0, re=0, bo=0, be=0;
for(var i= 0; i < a.length; i++) {
    if (i % 2 ===0) {
        if(a[i] === "r") {
            re++;
        }else{
            be++;
        }

    }else {
        if(a[i] === "r") {
            ro++;
        }else{
            bo++;
        }
    }
}
var m1 =Math.max(ro,be);
var m2 = Math.max(re,bo);
print(Math.min(m1,m2));

var d =readline();
var a =readline();
var ro=0,re=0,be=0,bo=0;
for(var e=0;e<a.length;e++){
    if(e%2===0){
        if(a[e]==="r"){
            re++;
        } else {
            be++;
        }
    } else {
        if(a[e]==="r"){
            ro++;
        } else {
            bo++;
        }

    }
}
print(Math.min(Math.max(ro,be),Math.max(re,bo)));

var a = readline();
print (a);
print (a.length);
var ro =0,re=0,bo=0,be=0;
for (var i=0;i<a.length;i++) {
    if (i % 2 === 0) {
        if (a[i] === "r") {
            re++;
        }
        else {
            be++;
        }
    } else {
        if (a[i] === "r") {
            ro++;
        }
        else {
            bo++;
        }
    }
}
var m1 = Math.max(ro,be);
var m2 = Math.max(re,bo);
print(Math.min(m1,m2));


//import { readline, print } from '@ip-algorithmics/codeforces-io';
var _a = readline().split(' ').map(function (v) { return +v; }), n = _a[0], q = _a[1];
var rr = Array(n + 1).fill(0);
var cc = Array(n + 1).fill(0);
var r = [];
var c = [];
var size = 200000;
while (size) {
    r.push(Array(size + 1).fill(0));
    c.push(Array(size + 1).fill(0));
    size = (size >> 1);
}
function add(a, i, v) {
    //print('add',i,v)
    for (var k = 0; k < a.length; k++) {
        if (~i & 1) {
            a[k][i >> 1] += v;
        }
        //print('addd', k, i, v);
        i >>= 1;
    }
}
function sum(a, i) {
    //print(`sum < ${i}:`);
    var res = 0;
    for (var k = 0; k < a.length; k++) {
        if (i & 1) {
            res += a[k][i >> 1];
            //print('summ', k, i, a[k][i-1]);
        }
        i >>= 1;
    }
    //print('sum', res);
    return res;
}
for (var i = 0; i < q; i++) {
    var b = readline().split(' ').map(function (v) { return +v; });
    //print('i',i);
    if (b[0] === 1) {
        var x = b[1];
        var y = b[2];
        rr[x]++;
        if (rr[x] === 1) {
            add(r, x, 1);
        }
        cc[y]++;
        if (cc[y] === 1) {
            add(c, y, 1);
        }
    }
    else if (b[0] === 2) {
        var x = b[1];
        var y = b[2];
        rr[x]--;
        if (rr[x] === 0) {
            add(r, x, -1);
        }
        cc[y]--;
        if (cc[y] === 0) {
            add(c, y, -1);
        }
    }
    else {
        if (sum(r, b[3] + 1) - sum(r, b[1]) === b[3] - b[1] + 1
            || sum(c, b[4] + 1) - sum(c, b[2]) === b[4] - b[2] + 1) {
            print('Yes');
        }
        else {
            print('No');
        }
    }
}

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, q] = lines[l++].trim().split(' ').map(Number)
        const qs = lines.slice(l, l + q).map(str => str.trim().split(' ').map(Number))
        l += q
        output[i] = solve(n, qs)
    }
    console.log(output.join('\n'))
// })()
})

function inc(F, idx, val) {
    for (; idx < F.length; idx |= idx + 1) {
        F[idx] += val
    }
}
function sum(F, idx) {
    let s = 0
    for (; idx >= 0; idx = (idx & (idx + 1)) - 1) {
        s += F[idx]
    }
    return s
}

function solve(n, qs) {
    const ans = []
    const row = Array(n).fill(0)
    const col = Array(n).fill(0)
    const rf = Array(n + 5).fill(0) // a little larger in case
    const cf = Array(n + 5).fill(0) // a little larger in case
    qs.forEach(([t, x, y, x2, y2]) => {
        x--; y--; x2--; y2--
        if (t === 1) {
            // add
            if (!row[x]++) inc(rf, x, 1)
            if (!col[y]++) inc(cf, y, 1)
        } else if (t === 2) {
            // remove
            if (!--row[x]) inc(rf, x, -1)
            if (!--col[y]) inc(cf, y, -1)
        } else {
            // query
            const nr = x2 - x + 1
            const nc = y2 - y + 1
            const kr = sum(rf, x2) - (x ? sum(rf, x - 1) : 0)
            const kc = sum(cf, y2) - (y ? sum(cf, y - 1) : 0)
        // console.log(nr, nc, '-', kr, kc)
            const ok = nr === kr || nc === kc
            ans.push(ok ? 'Yes' : 'No')
        }
    })
    return ans.join('\n')
}

'use strict';

var readline = require('readline');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);

function solve(n, m, ops) {
  const row = new Map(),
        column = new Map();
  const segTreeR = new SegTree(n + 10),
        segTreeC = new SegTree(n + 10);
  let res = [];
  for (let [t, a, b, c, d] of ops) {
    if (t === 1) {
      if (row.get(a)) {
        row.set(a, row.get(a) + 1);
      } else {
        row.set(a, 1);
        segTreeR.update(a, a, 1);
      }
      if (column.get(b)) {
        column.set(b, column.get(b) + 1);
      } else {
        column.set(b, 1);
        segTreeC.update(b, b, 1);
      }
    } else if (t === 2) {
      row.set(a, row.get(a) - 1);
      column.set(b, column.get(b) - 1);
      if (!row.get(a)) {
        segTreeR.update(a, a, -1);
      }
      if (!column.get(b)) {
        segTreeC.update(b, b, -1);
      }
    } else {
      const x = segTreeR.query(a, c),
            y = segTreeC.query(b, d);
      if (x === c - a + 1 || y === d - b + 1) {
        res.push('YES');
      } else {
        res.push('NO');
      }
    }
  }
  console.log(res.join('\n'));
}
class SegTree {
  constructor(n) {
    this.n = n;
    this.root = this._newNode(0, n);
    this.update = this._update.bind(this, this.root);
    this.query = this._query.bind(this, this.root);
  }
  _newNode(l, r, val = 0, left = null, right = null) {
    return {
      val,
      l,
      r,
      left,
      right,
      add: 0
    };
  }
  _update(node, x, y, z) {
    if (!node) return;
    const {
      l,
      r
    } = node;
    if (l === r) {
      node.val = z;
      return;
    }
    const mid = Math.floor((l + r) / 2);
    if (!node.left) {
      node.left = this._newNode(l, mid);
      node.right = this._newNode(mid + 1, r);
    }
    if (y <= mid) this._update(node.left, x, y, z);else if (x > mid) this._update(node.right, x, y, z);else this._update(node.left, x, mid, z), this._update(node.right, mid + 1, y, z);
    node.val = node.left.val + node.right.val;
  }
  _query(node, x, y) {
    if (y < x) return 0;
    if (!node) return 0;
    const {
      l,
      r
    } = node;
    if (l === x && r === y) return node.val;
    let res = 0,
        mid = Math.floor((l + r) / 2);
    if (y <= mid) res = this._query(node.left, x, y);else if (x > mid) res = this._query(node.right, x, y);else res = this._query(node.left, x, mid) + this._query(node.right, mid + 1, y);
    return res;
  }
}

async function main(read) {
  const [n, m] = (await read()).split(' ').map(Number);
  const b = [];
  let tmp = m;
  while (tmp--) {
    b.push((await read()).split(' ').map(Number));
  }
  solve(n, m, b);
}

const rl = readline__default["default"].createInterface({
  input: process.stdin,
  output: process.stdout
});
void async function () {
  const inputs = [];
  let i = 0;
  for await (const line of rl) {
    inputs.push(line.trim());
  }
  function read() {
    return inputs[i++];
  }
  await main(read);
}();

'use strict';
// HEADER:
const print = function(arg){
  let str = arg;
  if (arguments.length>1)
    str = Array.prototype.slice.call(arguments).join(' ');
  process.stdout.write(str+'\n');
};
let IS_MULTITEST, testN, tests;
const pcalc = (testN, toPrint)=>{
  let res = calc(testN);
  if (Array.isArray(res)){
    toPrint.push(res.join(' '));
  } else if (Number.isFinite(res) || typeof res=='string'){
    toPrint.push(res+'');
  }
  if (process.env.DEBUG && toPrint.length){
    let ans = toPrint.pop();
    print(ans);
    let expected = tests[testN-1];
    if (expected){
      if (expected==ans)
        console.log('\x1b[32m%s\x1b[0m', 'correct');
      else {
        console.log('\x1b[31m%s\x1b[0m', 'wrong, expected:', expected);
      }
    }
  }
};

const main = ()=>{
  let toPrint = [];
  L('\nSolving:');
  if (IS_MULTITEST){
    let T = +readline()
    for (testN=1; testN<=T; testN++)
      pcalc(T, toPrint);
  } else {
    pcalc(1, toPrint);
  }
  if (toPrint.length){
    print(toPrint.join('\n'));
  }
};

const lines = [];
const rl = require('readline').createInterface({
   input: process.stdin, output: process.stdout});
rl.on('line', line=>{
  lines.push(line);
});
rl.on('close', main);
let rli = 0;
const readline = ()=>lines[rli++];
const L = process.env.DEBUG ? console.log : ()=>{};
const LT = obj=>L(`\nTest #${testN}`, obj);

const ra = ()=>readline().split(' ').map(a=>+a)
const pa = arr=>print(arr.join(' '));

tests = [
];

// SOLUTION:
IS_MULTITEST = false;

class SegmentTree {
    constructor(arr){
        this.n = arr.length;
        this.l = null;
        this.r = null;
        this.sum = 0;
        this.toPush = null;
        this.build(arr);
    }
    getMiddle(){
        return Math.floor(this.n/2);
    }
    build(arr){
        if (arr.length==0)
            return;
        if (arr.length==1){
            this.sum = arr[0];
            return;
        }
        let m = this.getMiddle();
        let sum = 0;
        let leftArr = arr.slice(0, m);
        if (leftArr.length){
            this.l = new SegmentTree(leftArr);
            sum += this.l.sum;
        }
        let rightArr = arr.slice(m);
        if (rightArr.length){
            this.r = new SegmentTree(rightArr);
            sum += this.r.sum;
        }
        this.sum = sum;
    }
    push(){
      if (this.toPush==null)
        return;
      this.sum = this.n*this.toPush;
      if (this.r){
        this.r.toPush = this.toPush;
      }
      if (this.l){
        this.l.toPush = this.toPush;
      }
      this.toPush = null;
    }
    setAll(val){
      this.toPush = val;
    }
    set(i, val){
      this.push();
        if (this.n==1)
        {
            this.sum = val;
            return;
        }
        let m = this.getMiddle();
        if (i<m)
            this.l.set(i, val);
        else
            this.r.set(i-m, val);
        if (this.l)
          this.l.push();
        if (this.r)
          this.r.push();
        this.sum = (this.l ? this.l.sum : 0) +
            (this.r ? this.r.sum : 0);
    }
    sumRange(l, r){
        this.push();
        if (l==0 && r==this.n-1)
            return this.sum;
        let m = this.getMiddle();
        let sum = 0;
        if (l<m)
            sum += this.l.sumRange(l, Math.min(m-1, r));
        if (m<=r)
            sum += this.r.sumRange(Math.max(l-m, 0), r-m);
        return sum;
    }
}
const calc = (testN)=>{
  // READING:
  let [n, q] = ra();
  LT({n, q});
  // PROCESSING:
  let ans = [];
  let cnti = new Array(n).fill(0);
  let sti = new SegmentTree(cnti);
  let cntj = new Array(n).fill(0);
  let stj = new SegmentTree(cntj);

  while (q--){
    let [t, a1, a2, a3, a4] = ra();
    if (t==1){ // put a rook
      let x = a1-1, y = a2-1;
      cnti[x]++;
      if (cnti[x]==1)
        sti.set(x, 1);
      cntj[y]++;
      if (cntj[y]==1)
        stj.set(y, 1);
    } if (t==2){ // remove a rook
      let x = a1-1, y = a2-1;
      cnti[x]--;
      if (cnti[x]==0)
        sti.set(x, 0);
      cntj[y]--;
      if (cntj[y]==0)
        stj.set(y, 0);
    } if (t==3){ // query
      let x1 = a1-1, y1 = a2-1;
      let x2 = a3-1, y2 = a4-1;
      let si = sti.sumRange(Math.min(x1, x2), Math.max(x1, x2));
      if (si==Math.abs(x1-x2)+1){
        ans.push('Yes')
        continue;
      }
      let sj = stj.sumRange(Math.min(y1, y2), Math.max(y1, y2));
      if (sj==Math.abs(y1-y2)+1){
        ans.push('Yes')
        continue;
      }
        ans.push('No')
    }
  }
  return ans.join('\n');
};

//import { readline, print } from '@ip-algorithmics/codeforces-io';
var _a = readline().split(' ').map(function (v) { return +v; }), n = _a[0], q = _a[1];
var rr = Array(n + 1).fill(0);
var cc = Array(n + 1).fill(0);
var r = [];
var c = [];
var size = 200000;
while (size) {
    r.push(Array(size + 1).fill(0));
    c.push(Array(size + 1).fill(0));
    size = (size >> 1);
}
function add(a, i, v) {
    //print('add',i,v)
    for (var k = 0; k < a.length; k++) {
        //if (i & 1) {
        a[k][i] += v;
        //}
        //print('addd', k, i, v);
        i >>= 1;
    }
}
function sum(a, i) {
    //print(`sum < ${i}:`);
    var res = 0;
    for (var k = 0; k < a.length; k++) {
        if (i & 1) {
            res += a[k][i - 1];
            //print('summ', k, i, a[k][i-1]);
        }
        i >>= 1;
    }
    //print('sum', res);
    return res;
}
for (var i = 0; i < q; i++) {
    var b = readline().split(' ').map(function (v) { return +v; });
    //print('i',i);
    if (b[0] === 1) {
        var x = b[1];
        var y = b[2];
        rr[x]++;
        if (rr[x] === 1) {
            add(r, x, 1);
        }
        cc[y]++;
        if (cc[y] === 1) {
            add(c, y, 1);
        }
    }
    else if (b[0] === 2) {
        var x = b[1];
        var y = b[2];
        rr[x]--;
        if (rr[x] === 0) {
            add(r, x, -1);
        }
        cc[y]--;
        if (cc[y] === 0) {
            add(c, y, -1);
        }
    }
    else {
        if (sum(r, b[3] + 1) - sum(r, b[1]) === b[3] - b[1] + 1
            || sum(c, b[4] + 1) - sum(c, b[2]) === b[4] - b[2] + 1) {
            print('Yes');
        }
        else {
            print('No');
        }
    }
}

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, q] = lines[l++].trim().split(' ').map(Number)
        const qs = lines.slice(l, l + q).map(str => str.trim().split(' ').map(Number))
        l += q
        output[i] = solve(n, qs)
    }
    console.log(output.join('\n'))
// })()
})

function inc(F, idx, val) {
    for (; idx < F.length; idx |= idx + 1) {
        F[idx] += val
    }
}
function sum(F, idx) {
    let s = 0
    for (; idx >= 0; idx = (idx & (idx + 1)) - 1) {
        s += F[idx]
    }
    return s
}

function solve(n, qs) {
    const ans = []
    const row = Array(n).fill(0)
    const col = Array(n).fill(0)
    const rf = Array(n + 5).fill(0) // a little larger in case
    const cf = Array(n + 5).fill(0) // a little larger in case
    qs.forEach(([t, x, y, x2, y2]) => {
        x--; y--; x2--; y2--
        if (t === 1) {
            // add
            if (!row[x]++) inc(rf, x, 1)
            if (!col[y]++) inc(cf, y, 1)
        } else if (t === 2) {
            // remove
            if (!--row[x]) inc(rf, x, -1)
            if (!--col[x]) inc(cf, y, -1)
        } else {
            // query
            const nr = x2 - x + 1
            const nc = y2 - y + 1
            const kr = sum(rf, x2) - (x ? sum(rf, x - 1) : 0)
            const kc = sum(cf, y2) - (y ? sum(cf, y - 1) : 0)
        // console.log(nr, nc, '-', kr, kc)
            const ok = nr === kr || nc === kc
            ans.push(ok ? 'Yes' : 'No')
        }
    })
    return ans.join('\n')
}

//import { readline, print } from '@ip-algorithmics/codeforces-io';
var _a = readline().split(' ').map(function (v) { return +v; }), n = _a[0], q = _a[1];
var rr = Array(n + 1).fill(0);
var cc = Array(n + 1).fill(0);
var r = [];
var c = [];
var size = 200000;
while (size) {
    r.push(Array(size + 1).fill(0));
    c.push(Array(size + 1).fill(0));
    size = (size >> 1);
}
function add(a, i, v) {
    //print('add',i,v)
    for (var k = 0; k < a.length - 13; k++) {
        //if (i & 1) {
        a[k][i] += v;
        //}
        //print('addd', k, i, v);
        i >>= 1;
    }
}
function sum(a, i) {
    //print(`sum < ${i}:`);
    var res = 0;
    for (var k = 0; k < a.length - 13; k++) {
        if (i & 1) {
            res += a[k][i - 1];
            //print('summ', k, i, a[k][i-1]);
        }
        i >>= 1;
    }
    //print('sum', res);
    return res;
}
for (var i = 0; i < q; i++) {
    var b = readline().split(' ').map(function (v) { return +v; });
    //print('i',i);
    if (b[0] === 1) {
        var x = b[1];
        var y = b[2];
        rr[x]++;
        if (rr[x] === 1) {
            add(r, x, 1);
        }
        cc[y]++;
        if (cc[y] === 1) {
            add(c, y, 1);
        }
    }
    else if (b[0] === 2) {
        var x = b[1];
        var y = b[2];
        rr[x]--;
        if (rr[x] === 0) {
            add(r, x, -1);
        }
        cc[y]--;
        if (cc[y] === 0) {
            add(c, y, -1);
        }
    }
    else {
        if (sum(r, b[3] + 1) - sum(r, b[1]) === b[3] - b[1] + 1
            || sum(c, b[4] + 1) - sum(c, b[2]) === b[4] - b[2] + 1) {
            print('Yes');
        }
        else {
            print('No');
        }
    }
}

//import { readline, print } from '@ip-algorithmics/codeforces-io';
var _a = readline().split(' ').map(function (v) { return +v; }), n = _a[0], q = _a[1];
var rr = Array(n + 1).fill(0);
var cc = Array(n + 1).fill(0);
var r = [];
var c = [];
var size = 200000;
while (size) {
    r.push(Array(size + 1).fill(0));
    c.push(Array(size + 1).fill(0));
    size = (size >> 1);
}
function add(a, i, v) {
    //print('add',i,v)
    for (var k = 0; k < a.length; k++) {
        //if (i & 1) {
        a[k][i] += v;
        //}
        //print('addd', k, i>>1, v);
        i >>= 1;
    }
}
function sum(a, i) {
    //print(`sum <= ${i}:`);
    var res = 0;
    for (var k = 0; k < a.length; k++) {
        if (i & 1) {
            res += a[k][i];
            //print('summ', k, i>>1, a[k][i>>1]);
        }
        i >>= 1;
    }
    //print('sum', res);
    return res;
}
for (var i = 0; i < q; i++) {
    var b = readline().split(' ').map(function (v) { return +v; });
    //print('i',i);
    if (b[0] === 1) {
        var x = b[1];
        var y = b[2];
        rr[x]++;
        if (rr[x] === 1) {
            add(r, x, 1);
        }
        cc[y]++;
        if (cc[y] === 1) {
            add(c, y, 1);
        }
    }
    else if (b[0] === 2) {
        var x = b[1];
        var y = b[2];
        rr[x]--;
        if (rr[x] === 0) {
            add(r, x, -1);
        }
        cc[y]--;
        if (cc[y] === 0) {
            add(c, y, -1);
        }
    }
    else {
        if (sum(r, b[3] + 1) - sum(r, b[1]) === b[3] - b[1] + 1
            || sum(c, b[4] + 1) - sum(c, b[2]) === b[4] - b[2] + 1) {
            print('Yes');
        }
        else {
            print('No');
        }
    }
}

//import { readline, print } from '@ip-algorithmics/codeforces-io';
var _a = readline().split(' ').map(function (v) { return +v; }), n = _a[0], q = _a[1];
var rr = Array(n + 1).fill(0);
var cc = Array(n + 1).fill(0);
var r = [];
var c = [];
var size = 200000;
while (size) {
    r.push(Array(size + 1).fill(0));
    c.push(Array(size + 1).fill(0));
    size = (size >> 1);
}
function add(a, i, v) {
    //print('add',i,v)
    for (var k = 0; k < a.length; k++) {
        //if (i & 1) {
        a[k][i] += v;
        //}
        //print('addd', k, i>>1, v);
        i >>= 1;
    }
}
function sum(a, i) {
    //print(`sum <= ${i}:`);
    var res = 0;
    for (var k = 0; k < a.length; k++) {
        if (i & 1) {
            res += a[k][i];
            //print('summ', k, i>>1, a[k][i>>1]);
        }
        i >>= 1;
    }
    //print('sum', res);
    return res;
}
for (var i = 0; i < q; i++) {
    var b = readline().split(' ').map(function (v) { return +v; });
    //print('i',i);
    if (b[0] === 1) {
        var x = b[1];
        var y = b[2];
        rr[x]++;
        if (rr[x] === 1) {
            add(r, x, 1);
        }
        cc[y]++;
        if (cc[y] === 1) {
            add(c, y, 1);
        }
    }
    else if (b[0] === 2) {
        var x = b[1];
        var y = b[2];
        rr[x]--;
        if (rr[x] === 0) {
            add(r, x, -1);
        }
        cc[y]--;
        if (cc[y] === 0) {
            add(c, y, -1);
        }
    }
    else {
        if (sum(r, b[3]) - sum(r, b[1] - 1) === b[3] - b[1] + 1
            || sum(c, b[4]) - sum(c, b[2] - 1) === b[4] - b[2] + 1) {
            print('Yes');
        }
        else {
            print('No');
        }
    }
}

//import { readline, print } from '@ip-algorithmics/codeforces-io';
var _a = readline().split(' ').map(function (v) { return +v; }), n = _a[0], q = _a[1];
var rr = Array(n + 1).fill(0);
var cc = Array(n + 1).fill(0);
var r = [];
var c = [];
var size = 200000;
while (size) {
    r.push(Array(size + 1).fill(0));
    c.push(Array(size + 1).fill(0));
    size = (size >> 1);
}
function add(a, i, v) {
    //print('add',i,v)
    for (var k = 0; k < a.length; k++) {
        //if (i & 1) {
        a[k][i >> 1] += v;
        //}
        //print('addd', k, i>>1, v);
        i >>= 1;
    }
}
function sum(a, i) {
    //print(`sum <= ${i}:`);
    var res = 0;
    for (var k = 0; k < a.length; k++) {
        if (i & 1) {
            res += a[k][i >> 1];
            //print('summ', k, i>>1, a[k][i>>1]);
        }
        i >>= 1;
    }
    //print('sum', res);
    return res;
}
for (var i = 0; i < q; i++) {
    var b = readline().split(' ').map(function (v) { return +v; });
    //print('i',i);
    if (b[0] === 1) {
        var x = b[1];
        var y = b[2];
        rr[x]++;
        if (rr[x] === 1) {
            add(r, x, 1);
        }
        cc[y]++;
        if (cc[y] === 1) {
            add(c, y, 1);
        }
    }
    else if (b[0] === 2) {
        var x = b[1];
        var y = b[2];
        rr[x]--;
        if (rr[x] === 0) {
            add(r, x, -1);
        }
        cc[y]--;
        if (cc[y] === 0) {
            add(c, y, -1);
        }
    }
    else {
        if (sum(r, b[3]) - sum(r, b[1] - 1) === b[3] - b[1] + 1
            || sum(c, b[4]) - sum(c, b[2] - 1) === b[4] - b[2] + 1) {
            print('Yes');
        }
        else {
            print('No');
        }
    }
}

//import { readline, print } from '@ip-algorithmics/codeforces-io';
var _a = readline().split(' ').map(function (v) { return +v; }), n = _a[0], q = _a[1];
var rr = Array(n + 1).fill(0);
var cc = Array(n + 1).fill(0);
var r = [];
var c = [];
var size = 200000;
while (size) {
    r.push(Array(size + 1).fill(0));
    c.push(Array(size + 1).fill(0));
    size = (size >> 1);
}
function add(a, i, v) {
    //print('add',i,v)
    for (var k = 0; k < a.length - 13; k++) {
        //if (i & 1) {
        a[k][i >> 1] += v;
        //}
        //print('addd', k, i>>1, v);
        i >>= 1;
    }
}
function sum(a, i) {
    //print(`sum <= ${i}:`);
    var res = 0;
    for (var k = 0; k < a.length - 13; k++) {
        if (i & 1) {
            res += a[k][i >> 1];
            //print('summ', k, i>>1, a[k][i>>1]);
        }
        i >>= 1;
    }
    //print('sum', res);
    return res;
}
for (var i = 0; i < q; i++) {
    var b = readline().split(' ').map(function (v) { return +v; });
    //print('i',i);
    if (b[0] === 1) {
        var x = b[1];
        var y = b[2];
        rr[x]++;
        if (rr[x] === 1) {
            add(r, x, 1);
        }
        cc[y]++;
        if (cc[y] === 1) {
            add(c, y, 1);
        }
    }
    else if (b[0] === 2) {
        var x = b[1];
        var y = b[2];
        rr[x]--;
        if (rr[x] === 0) {
            add(r, x, -1);
        }
        cc[y]--;
        if (cc[y] === 0) {
            add(c, y, -1);
        }
    }
    else {
        if (sum(r, b[3]) - sum(r, b[1] - 1) === b[3] - b[1] + 1
            || sum(c, b[4]) - sum(c, b[2] - 1) === b[4] - b[2] + 1) {
            print('Yes');
        }
        else {
            print('No');
        }
    }
}


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 permute(arr, i) {
	if (i == arr.length) {
		var num = 0;
		for (var j = 0; j < arr.length; j += 1) {
			num = 10*num + arr[j];
		}
		print(num + ' % 7 = ' + (num%7));
		return;
	}
	permute(arr, i+1);
	var t = arr[i];
	for (var j = i+1; j < arr.length; j += 1) {
		arr[i] = arr[j];
		arr[j] = t;
		permute(arr, i+1);
		arr[j] = arr[i];
	}
	arr[i] = t;
}

function main() {
	var reverseMod = [1869, 1968, 1689, 6198, 1698, 1986, 1896];
	var s = trim(readline());

	var seek1 = true, seek6 = true, seek8 = true, seek9 = true;
	var digits = [];
	var zeros = [];
	for (var i = 0; i < s.length; i += 1) {
		if (s[i] == '1') {
			if (seek1) {
				seek1 = false;
				continue;
			}
		}
		else if (s[i] == '6') {
			if (seek6) {
				seek6 = false;
				continue;
			}
		}
		else if (s[i] == '8') {
			if (seek8) {
				seek8 = false;
				continue;
			}
		}
		else if (s[i] == '9') {
			if (seek9) {
				seek9 = false;
				continue;
			}
		}
		else if (s[i] == '0') {
			zeros.push('0');
			continue;
		}
		digits.push(parseInt(s[i]));
	}

	write(digits.join(''));

	var remainder = 0;
	for (var i = 0; i < digits.length; i += 1) {
		remainder = (10*remainder + digits[i]) % 7;
	}

	remainder = (10000*remainder) % 7;

	write(reverseMod[(7-remainder)%7]);
	print(zeros.join(''));
}

main();

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 permute(arr, i) {
	if (i == arr.length) {
		var num = 0;
		for (var j = 0; j < arr.length; j += 1) {
			num = 10*num + arr[j];
		}
		print(num + ' % 7 = ' + (num%7));
		return;
	}
	permute(arr, i+1);
	var t = arr[i];
	for (var j = i+1; j < arr.length; j += 1) {
		arr[i] = arr[j];
		arr[j] = t;
		permute(arr, i+1);
		arr[j] = arr[i];
	}
	arr[i] = t;
}

function main() {
	var mods = [1869, 1968, 1689, 6198, 1698, 1986, 1896];
	var s = trim(readline());

	var seek1 = true, seek6 = true, seek8 = true, seek9 = true;
	var remainder = 0;
	var zeros = [];
	for (var i = s.length-1; i >= 0; i -= 1) {
		if (s[i] == '1') {
			if (seek1) {
				s = s.slice(0, i) + s.slice(i+1);
				seek1 = false;
				continue;
			}
		}
		else if (s[i] == '6') {
			if (seek6) {
				s = s.slice(0, i) + s.slice(i+1);
				seek6 = false;
				continue;
			}
		}
		else if (s[i] == '8') {
			if (seek8) {
				s = s.slice(0, i) + s.slice(i+1);
				seek8 = false;
				continue;
			}
		}
		else if (s[i] == '9') {
			if (seek9) {
				s = s.slice(0, i) + s.slice(i+1);
				seek9 = false;
				continue;
			}
		}
		else if (s[i] == '0') {
			s = s.slice(0, i) + s.slice(i+1);
			zeros.push('0');
			remainder = (10*remainder) % 7;
			continue;
		}
		remainder = (10*remainder + s[i]) % 7;
	}

	write(s);
	write(mods[(7-remainder)%7]);
	print(zeros.join(''));
}

main();

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 permute(arr, i) {
	if (i == arr.length) {
		var num = 0;
		for (var j = 0; j < arr.length; j += 1) {
			num = 10*num + arr[j];
		}
		print(num + ' % 7 = ' + (num%7));
		return;
	}
	permute(arr, i+1);
	var t = arr[i];
	for (var j = i+1; j < arr.length; j += 1) {
		arr[i] = arr[j];
		arr[j] = t;
		permute(arr, i+1);
		arr[j] = arr[i];
	}
	arr[i] = t;
}

function main() {
	var mods = [1869, 1968, 1689, 6198, 1698, 1986, 1896];
	var s = trim(readline());

	var seek1 = true, seek6 = true, seek8 = true, seek9 = true;
	var zeros = [];
	for (var i = s.length-1; i >= 0; i -= 1) {
		if (s[i] == '1') {
			if (seek1) {
				s = s.slice(0, i) + s.slice(i+1);
				seek1 = false;
				continue;
			}
		}
		else if (s[i] == '6') {
			if (seek6) {
				s = s.slice(0, i) + s.slice(i+1);
				seek6 = false;
				continue;
			}
		}
		else if (s[i] == '8') {
			if (seek8) {
				s = s.slice(0, i) + s.slice(i+1);
				seek8 = false;
				continue;
			}
		}
		else if (s[i] == '9') {
			if (seek9) {
				s = s.slice(0, i) + s.slice(i+1);
				seek9 = false;
				continue;
			}
		}
		else if (s[i] == '0') {
			s = s.slice(0, i) + s.slice(i+1);
			zeros.push('0');
			continue;
		}
	}

	write(s);

	var remainder = 0;
	for (var i = 0; i < s.length; i += 1) {
		remainder = (10*remainder + parseInt(s[i])) % 7;
	}

	write(mods[(7-remainder)%7]);
	print(zeros.join(''));
}

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();
    });

    probC();
});

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

function probC(){
    let t = parseInt(readline());
    while(t > 0){
        t--;
        let count = new Array(100001);
        let n = parseInt(readline());
        let arr = readline().split(' ');
        let max = 0;

        for(let i = 0; i < n; i++){
            let index = parseInt(arr[i]);
            if(count[index])
                count[index]++;
            else
                count[index] = 1;

            max = Math.max(max, count[index]);
        }

        let maxCount = 0;
        for(let i = 0; i < count.length; i++){
            if(count[i] === max)
                maxCount++;
        }

        console.log(Math.floor((n-maxCount) / (max-1)) - 1);
    }
}

function main(){
    let n = parseInt(readline());
    let a = readline().split(' ');
    let map = new Array(100000 + 1);
    map.fill(0);
    let count = {'4': 0, '2': 0};
    for(let i = 0; i < a.length; i++){
        let index = parseInt(a[i]);
        if(map[index]){
            map[index] += 1;
            if(map[index] % 4 === 0)
                count[4] += 1;

            if(map[index] % 2 === 0)
                count[2] += 1;
        }
        else
            map[index] = 1;
    }

    let o = parseInt(readline());
    for(let i = 0; i < o; i++){
        let x = readline().split(' ');
        if(x[0] === '+'){
            map[parseInt(x[1])] += 1;
            if(map[parseInt(x[1])] % 4 === 0)
                count[4]++;

            if(map[parseInt(x[1])] % 2 === 0)
                count[2]++;
        }else{
            let f1 = map[parseInt(x[1])] % 4 === 0;
            let f2 = map[parseInt(x[1])] % 2 === 0;
            map[parseInt(x[1])] -= 1;
            if(f1 && map[parseInt(x[1])] % 4 !== 0)
                count[4]--;

            if(f2 && map[parseInt(x[1])] % 2 !== 0)
                count[2]--;
        }

        if(count[4] >= 2){
            console.log('yes');
        }else if(count[4] >= 1 && count[2]-(2*count[4]) >= 2){
            console.log('yes');
        }else{
            console.log('no');
        }
    }
}

(()=>{"use strict";var t={675:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),Array.numbersMatrix=(t,e,r)=>{let n=[];null==t&&(e=t),null==r&&(r=0);for(let o=0;o<t;++o){let t=[];for(let n=0;n<e;++n)t.push(r);n.push(t)}return n},Array.prototype.sortAsc=function(){return this.sort(((t,e)=>t-e))},Array.prototype.sortDesc=function(){return this.sort(((t,e)=>e-t))},Array.prototype.max=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.max(t,this[e]);return t},Array.prototype.min=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.min(t,this[e]);return t},Array.prototype.sum=function(){let t=0;for(let e=0;e<this.length;++e)t+=this[e];return t},Array.prototype.modSum=function(t){let e=0;for(let r=0;r<this.length;++r)e+=this[r],e%=t;return e},Array.prototype.avg=function(){return this.sum()/this.length},Array.prototype.groupBy=function(t){let e=new Map;for(let r=0;r<this.length;++r){const n=t(this[r]);e.has(n)?e.get(n).push(this[r]):e.set(n,[this[r]])}return e},Array.prototype.deepCopy=function(){let t=[];if(0==this.length)return t;let e=!1;Array.isArray(this[0])&&(e=!0);for(let r=0;r<this.length;++r)e?t.push(this[r].deepCopy()):t.push(this[r]);return t},Array.prototype.transpose=function(){let t=[];if(0==this.length)return[[]];for(let e=0;e<this[0].length;++e){let r=[];for(let t=0;t<this.length;++t)r.push(this[t][e]);t.push(r)}return t},Array.prototype.toString=function(){if(0==this.length)return"";if(!Array.isArray(this[0]))return this.join(" ");let t="";for(let e=0;e<this.length;++e)t+=this[e].join(" "),e!=this.length-1&&(t+="\n");return t}},312:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(r(747));let s="",i=[],u=0,l="";const a="local"===process.argv[2],p=t=>{if(a){if(i=o.default.readFileSync("input.txt").toString().trim().split("\n").map((t=>t.trim())),t(),o.default.writeFileSync("output.txt",l),console.log(l),o.default.readFileSync("expected.txt").toString().trim()==l.trim()){const{exec:t}=r(129);t("osascript -e 'display notification \"✅ AC!!\"'")}}else process.stdin.resume(),process.stdin.setEncoding("utf-8"),process.stdin.on("data",(t=>{s+=t})),process.stdin.on("end",(e=>{i=s.trim().split("\n").map((t=>t.trim())),t(),console.log(l)}))};function h(){return i[u++]}function f(){return h().split(" ").map((t=>parseFloat(t)))}function c(){return h().split("")}e.default={runMain:p,runEachTest:t=>{p((()=>{let[e]=f();for(;e>0;)t(),e--}))},readline:h,nextNumbers:f,nextBigNumbers:function(){return h().split(" ").map((t=>BigInt(t)))},nextNumbersMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(f());return e},nextCharacters:c,nextCharacterMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(c());return e},nextIntervalArray:function(t){let e=[];for(let r=0;r<t;++r){const[t,r]=f();e.push({a:t,b:r})}return e},put:function(t){l+=t},puts:function(t){l+=t+"\n"},debug:function(t){a&&console.log(t)}}},965:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),r(675);const o=n(r(312));o.default.runEachTest((function(){let[t]=o.default.nextNumbers(),e=o.default.nextNumbers(),r={};for(let t of e)r[t]=r[t]+1||1;let n=Object.values(r).sortDesc(),s=n[0],i=1,u=s,l=0;for(;n[i]==s;)u+=s,i++,l++;o.default.puts(l+Math.floor((t-u)/(s-1)))}))},129:t=>{t.exports=require("child_process")},747:t=>{t.exports=require("fs")}},e={};!function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}(965)})();

// Solution written in typescript and compiled via webpack. Original source code below
// Happy Hacking 😜

// import './array'
//
// import io from './io'
//
// function main() {
//   let [n] = io.nextNumbers()
//   let a = io.nextNumbers()
//
//   let m = {}
//
//   for (let x of a) {
//     m[x] = m[x] + 1 || 1
//   }
//
//   let v = Object.values(m).sortDesc() as number[]
//
//   let s = v[0]
//
//   let i = 1
//
//   let f = s
//   let c = 0
//
//   while (v[i] == s) {
//     f += s
//     i++
//     c++
//   }
//
//   io.puts(c + Math.floor((n - f) / (s - 1)))
// }
//
// io.runEachTest(main)
// // io.runMain(main)

(()=>{"use strict";var t={675:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),Array.numbersMatrix=(t,e,r)=>{let n=[];null==t&&(e=t),null==r&&(r=0);for(let o=0;o<t;++o){let t=[];for(let n=0;n<e;++n)t.push(r);n.push(t)}return n},Array.prototype.sortAsc=function(){return this.sort(((t,e)=>t-e))},Array.prototype.sortDesc=function(){return this.sort(((t,e)=>e-t))},Array.prototype.max=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.max(t,this[e]);return t},Array.prototype.min=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.min(t,this[e]);return t},Array.prototype.sum=function(){let t=0;for(let e=0;e<this.length;++e)t+=this[e];return t},Array.prototype.modSum=function(t){let e=0;for(let r=0;r<this.length;++r)e+=this[r],e%=t;return e},Array.prototype.avg=function(){return this.sum()/this.length},Array.prototype.groupBy=function(t){let e=new Map;for(let r=0;r<this.length;++r){const n=t(this[r]);e.has(n)?e.get(n).push(this[r]):e.set(n,[this[r]])}return e},Array.prototype.deepCopy=function(){let t=[];if(0==this.length)return t;let e=!1;Array.isArray(this[0])&&(e=!0);for(let r=0;r<this.length;++r)e?t.push(this[r].deepCopy()):t.push(this[r]);return t},Array.prototype.transpose=function(){let t=[];if(0==this.length)return[[]];for(let e=0;e<this[0].length;++e){let r=[];for(let t=0;t<this.length;++t)r.push(this[t][e]);t.push(r)}return t},Array.prototype.toString=function(){if(0==this.length)return"";if(!Array.isArray(this[0]))return this.join(" ");let t="";for(let e=0;e<this.length;++e)t+=this[e].join(" "),e!=this.length-1&&(t+="\n");return t}},312:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(r(747));let s="",i=[],u=0,l="";const a="local"===process.argv[2],p=t=>{if(a){if(i=o.default.readFileSync("input.txt").toString().trim().split("\n").map((t=>t.trim())),t(),o.default.writeFileSync("output.txt",l),console.log(l),o.default.readFileSync("expected.txt").toString().trim()==l.trim()){const{exec:t}=r(129);t("osascript -e 'display notification \"✅ AC!!\"'")}}else process.stdin.resume(),process.stdin.setEncoding("utf-8"),process.stdin.on("data",(t=>{s+=t})),process.stdin.on("end",(e=>{i=s.trim().split("\n").map((t=>t.trim())),t(),console.log(l)}))};function f(){return i[u++]}function h(){return f().split(" ").map((t=>parseFloat(t)))}function c(){return f().split("")}e.default={runMain:p,runEachTest:t=>{p((()=>{let[e]=h();for(;e>0;)t(),e--}))},readline:f,nextNumbers:h,nextBigNumbers:function(){return f().split(" ").map((t=>BigInt(t)))},nextNumbersMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(h());return e},nextCharacters:c,nextCharacterMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(c());return e},nextIntervalArray:function(t){let e=[];for(let r=0;r<t;++r){const[t,r]=h();e.push({a:t,b:r})}return e},put:function(t){l+=t},puts:function(t){l+=t+"\n"},debug:function(t){a&&console.log(t)}}},965:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),r(675);const o=n(r(312));o.default.runEachTest((function(){let[t]=o.default.nextNumbers(),e=o.default.nextNumbers(),r={};for(let t of e)r[t]=r[t]+1||1;let n=Object.values(r).sortDesc(),s=n[0],i=1,u=s,l=0;for(;n[i]==s;)u+=s,i++,l++;o.default.debug(u),o.default.puts(Math.floor((t-u+l)/(s-1)))}))},129:t=>{t.exports=require("child_process")},747:t=>{t.exports=require("fs")}},e={};!function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}(965)})();

// Solution written in typescript and compiled via webpack. Original source code below
// Happy Hacking 😜

// import './array'
//
// import io from './io'
//
// function main() {
//   let [n] = io.nextNumbers()
//   let a = io.nextNumbers()
//
//   let m = {}
//
//   for (let x of a) {
//     m[x] = m[x] + 1 || 1
//   }
//
//   let v = Object.values(m).sortDesc() as number[]
//
//   let s = v[0]
//
//   let i = 1
//
//   let f = s
//   let c = 0
//
//   u
//
//   while (v[i] == s) {
//     f += s
//     i++
//     c++
//   }
//
//   // io.debug(f)
//
//   io.puts(Math.floor((n - f + c) / (s - 1)))
// }
//
// io.runEachTest(main)
// // io.runMain(main)


"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}
function getValue() {
  return parseInt(readline());
}
let mod = BigInt(1e9 + 7);
const solve = () => {
  let t = 1;
  while (t--) {
    let [n, q, k] = iInpArr();
    let arr = iInpArr(),
      objA = [];
    for (let i = 0; i < n; i++) {
      let a = arr[i] - 1,
        d = k - arr[i],
        b,
        c;
      if (i === 0) b = 0;
      else b = arr[i] - arr[i - 1] - 1;
      if (i === n - 1) c = 0;
      else c = arr[i + 1] - arr[i] - 1;
      objA[i] = { a, b, c, d };
    }
    let frd = {},
      sum = 0;
    for (let i = 0; i < n; i++) {
      sum += objA[i].b + objA[i].c;
      frd[i] = sum;
    }
    for (let i = 0; i < q; i++) {
      let [s, e] = iInpArr();
      s--;
      e--;
      if (s === e) console.log(objA[s].a + objA[s].d);
      else if (s + 1 === e)
        console.log(objA[s].a + objA[e].d + objA[s].c + objA[e].b);
      else {
        let sum = 0;
        sum += frd[e - 1] - frd[s];
        sum += objA[s].a + objA[e].d + objA[s].c + objA[e].b;
        console.log(sum);
      }
    }
  }
};
solve();

'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() {
  // let testCases = readline()
  // while(testCases--)
    solve()

}

// function to solve problems
function solve (){
  let [n,q,k] = readline().split(' ').map(x => +x)
  // let q = arr[1], k = arr[2]
  let myArr = readline().split(' ').map(x => +x)//new Array(n)

  // readline().split(' ').map((x,i) => {
  //   myArr[i] = +x
  // })

  // ====== SOLUTION ======
  while(q--) {
    let [l,r] = readline().split(' ').map(x => +x)
    let arrLen = r - l + 1
    let ans = 0

    ans += myArr[l-1] - 1 // * true

    ans += 2*((myArr[r-1] - myArr[l-1] + 1) - arrLen)

    // checkbackward of last Element
    ans += k - myArr[r-1] // * true
    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++]
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // let testCases = readline()
  // while(testCases--)
    solve()

}

// function to solve problems
function solve (){
  let [n,q,k] = readline().split(' ').map(x => +x)
  // let q = arr[1], k = arr[2]
  let myArr = new Array(n)

  readline().split(' ').map((x,i) => {
    myArr[i] = +x
  })

  // ====== SOLUTION ======
  while(q--) {
    let [l,r] = readline().split(' ').map(x => +x)
    let arrLen = r - l + 1
    let ans = 0

    ans += myArr[l-1] - 1 // * true

    ans += 2*((myArr[r-1] - myArr[l-1] + 1) - arrLen)

    // checkbackward of last Element
    ans += k - myArr[r-1] // * true
    console.log(ans)
  }
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let [n, q, k] = rna();
	let a = rna();

	for (let i = 0; i < q; i++) {
		let [l, r] = rna();
		l--;r--;

		ans = 2 * (a[r] - a[l] - r + l ) + a[l] - 1 + k - a[r];
		console.log(ans);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let [n, q, k] = rna();
	let a = rna();

	let sum = [0];
	for (let i = 1; i < n; i++) {
		sum[i] = sum[i-1] + a[i] - a[i-1] - 1;
	}

	for (let i = 0; i < q; i++) {
		let [l, r] = rna();
		l--;r--;

		ans = 2 * (sum[r] - sum[l]) + a[l] - 1 + k - a[r];
		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++];
}

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

function main() {

    // 1 1 7
    // 6 9, 15, 18
    var [n, q, k] = readline().split(' ').map((x, i) => {
        // if (minA > Number(x)) minA = Number(x)
        return parseInt(x)
    })
    var a = new Array(n + 1)
    readline().split(' ').map((x, i) => {
        // if (minA > Number(x)) minA = Number(x)
        a[i + 1] = x
    })
    var answer = 0
    for (var i = 0; i < q; i++) {
        var [l, r] = readline().split(' ').map((x, i) => {
            // if (minA > Number(x)) minA = Number(x)
            return parseInt(x)
        })
        answer = (a[l] - 1 + k-a[r]) + 2 * (a[r] - a[l] + 1 - r + l - 1)
        console.log(answer)
    }
}

function swap(a, b) {
    var c = a
    a = b
    b = c
}


//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
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';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//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 t = nextInt();
	for(var i = 0; i < t; i++){
		var N = nextInt();
		var isOK = false;
		for(var j = 1; j * j <= N; j++){
			if(j * j * 2 == N || j * j * 4 == N){
				isOK = true;
				break;
			}
		}
		myout((isOK) ? "YES" : "NO");
	}
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
let obj = {};
const precompute = () => {
  let n = 50000;
  for (let i = 1; i <= n; i++) obj[i * i] = 1;
};
const solve = () => {
  let t = parseInt(readline());
  precompute();
  while (t--) {
    let n = parseInt(readline());
    if (n % 2) {
      console.log("NO");
      continue;
    }
    let k = n / 2;
    if (obj[k]) console.log("YES");
    else if (obj[k / 2]) console.log("YES");
    else console.log("NO");
  }
};
solve();

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
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  var a = parseInt(readline())
  while(a--){
    var b = parseInt(readline())
    var c = Math.floor(Math.sqrt(b/2))
    var d = Math.floor(Math.sqrt(b/4))
    print(c * c * 2 == b || d * d * 4 == b ?"YES":"NO")
  }
}

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
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  let a = parseInt(readline());
  while (a--) {
    let b = parseInt(readline());
    let c = Math.floor(Math.sqrt(b / 2));
    let d = Math.floor(Math.sqrt(b / 4));
    print(c * c * 2 == b || d * d * 4 == b ? "YES" : "NO");
  }
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    if (n === 1) console.log("NO");
    else if (n === 3) console.log("NO");
    else if (n === 2) console.log("YES");
    else {
      while (n > 2) n = Math.floor(n / 2);
      if (n === 1) console.log("NO");
      else console.log("YES");
    }
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    if (n === 1) console.log("NO");
    if (n === 3) console.log("NO");
    if (n === 2) console.log("YES");
    else {
      while (n > 2) n = Math.floor(n / 2);
      if (n === 1) console.log("NO");
      else console.log("YES");
    }
  }
};
solve();

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
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  var a = parseInt(readline())
  while(a--){
    var b = parseInt(readline())
    var c = Math.floor(Math.sqrt(b/2))
    var d = Math.floor(Math.sqrt(b/4))
    print(d)
    print(c * c * 2 == b || d * d * 4 == b ?"YES":"NO")
  }
}

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
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

// ********** Code Start **********
function main() {
  var a = parseInt(readline())
  while(a--){
    var b = parseInt(readline())
    var c = Math.sqrt(b/2)
    var d = Math.sqrt(b/4)
    print(c * c * 2 == b || d * d * 4 == b ?"YES":"NO")
  }
}