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 length = parseInt(readline(), 10),
		items = tokenizeIntegers(readline()),
		left = 0, right = length-1;

	while (items[left] == left+1) {
		++left;
		if (left == length) {
			print("0 0");
			return;
		}
	}

	while (items[right] == right+1) {
		--right;
	}

	for (var delta = 0; right-delta >= left; ++delta) {
		if (items[right-delta] != left+1+delta) {
			print("0 0");
			return;
		}
	}
	print([left+1, right+1].join(" "));
}

main();

'use strict'

let lll
let N = +readline()
lll = readline().split(' ').map(v => parseInt(v))
let ss = []
for (let i = 1; i < lll.length; i++) {
  ss.push(Math.sign(lll[i] - lll[i - 1]))
}

let ifm = ss.indexOf(-1)
let ilm = ss.lastIndexOf(-1)

if (~ifm && ~ilm) {
  let bad
  for (let i = ifm; i < ilm; i++) {
    if (ss[i] == 1) {
      bad = true
      break
    }
  }
  if (bad) {
    print('0 0')
  } else {
    let ns = lll.slice(0, ifm).concat(lll.slice(ifm, ilm + 2).reverse(), lll.slice(ilm + 2))
    for (let i = 1; i < ns.length; i++) {
      if (ns[i] < ns[i - 1]) {bad = true; break}
    }
    print(bad ? '0 0' : (ifm + 1) + ' ' + (ilm + 2))
  }
} else {
  print('0 0')
}

'use strict';

/*let input = `2
2 1`.split('\n');
function print(output) {
	console.log(output);
}
function readline() {
	return input.shift();
}*/

//code

var n = Number(readline());
var num = readline().split(' ').map(Number);
num.unshift(0);
var j = 1,
    lIndex = void 0,
    rIndex = void 0,
    sum = void 0;
while (j < num.length && num[j] === j) {
	j++;
}
//first break
lIndex = j;
if (lIndex === num.length || num[lIndex] <= lIndex || num[lIndex] > n) {
	print("0 0");
} else {
	sum = lIndex + num[lIndex];
	rIndex = num[lIndex];
	while (j <= rIndex && num[j] + j === sum) {
		j++;
	}
	//second break
	if (j !== rIndex + 1) {
		print("0 0");
	} else {
		while (j < num.length && num[j] === j) {
			j++;
		}
		//last break
		if (j === num.length) {
			print(lIndex + " " + rIndex);
		} else {
			print("0 0");
		}
	}
}

'use strict'

let lll
let N = +readline()
lll = readline().split(' ').map(v => parseInt(v))
let ss = []
for (let i = 1; i < lll.length; i++) {
  ss.push(Math.sign(lll[i] - lll[i - 1]))
}

let ifm = ss.indexOf(-1)
let ilm = ss.lastIndexOf(-1)

if (~ifm && ~ilm && ifm != ilm) {
  let bad
  for (let i = ifm; i < ilm; i++) {
    if (ss[i] == 1) {
      bad = true
      break
    }
  }
  print(bad ? '0 0' : (ifm + 1) + ' ' + (ilm + 2))
} else {
  print('0 0')
}

'use strict';

/*let input = `4
1 2 3 4`.split('\n');
function print(output) {
	console.log(output);
}
function readline() {
	return input.shift();
}
*/
//code

var n = Number(readline());
var num = readline().split(' ').map(Number);
num.unshift(0);
var j = 0,
    lIndex = void 0,
    rIndex = void 0;
while (j < num.length && num[j] === j) {
	j++;
}
//first break
lIndex = j;
if (lIndex === num.length || num[lIndex] <= lIndex || lIndex + num[lIndex] !== n) {
	print("0 0");
} else {
	rIndex = num[lIndex];
	while (j <= rIndex && num[j] + j === n) {
		j++;
	}
	//second break
	if (j !== rIndex + 1) {
		print("0 0");
	} else {
		while (j < num.length && num[j] === j) {
			j++;
		}
		//last break
		if (j === num.length) {
			print(lIndex + ' ' + rIndex);
		} else {
			print("0 0");
		}
	}
}


'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);

const N = 10 ** 9;
const dp = [];
let cur = 0;
for (let i = 0;; i++) {
  var _dp;
  if (i % 3 !== 2) cur += 2;
  dp[i] = ((_dp = dp[i - 1]) !== null && _dp !== void 0 ? _dp : 0) + cur;
  if (dp[i] > N) break;
}
function solve(n) {
  let l = 0,
      r = dp.length - 1;
  while (l < r) {
    const mid = l + r >> 1;
    if (dp[mid] < n) {
      l = mid + 1;
    } else {
      r = mid;
    }
  }
  return l + 2;
}

async function main(read) {
  let t = Number(await read());
  let res = [];
  while (t--) {
    const n = Number(await read());
    res.push(solve(n));
  }
  console.log(res.join('\n'));
}

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


var n = readline();
var s = readline()

var letters = ['a', 'i', 'u', 'y']
var lettters = ['o', 'e']

var ss = ""
var k = 1;

for (var i = 1; i < s.length; ++i) {
  if (s[i] == s[i - 1]) ++k;
  else {
    if (k > 1) {
      if (letters.indexOf(s[i - 1]) != -1) {
        ss += s[i - 1];
      }
      else if (lettters.indexOf(s[i - 1]) != -1) {
        if (k > 2) ss += s[i - 1];
        else ss += s[i - 1] + s[i - 1];
      }
      else {
        for (var q = 0; q < k; ++q) ss += s[i - 1];
      }
    }
    else ss += s[i - 1];
    k = 1;
  }
}

var i = s.length
if (k > 1) {
  if (letters.indexOf(s[i - 1]) != -1) {
    ss += s[i - 1];
  }
  else if (lettters.indexOf(s[i - 1]) != -1) {
    if (k > 2) ss += s[i - 1];
    else ss += s[i - 1] + s[i - 1];
  }
  else {
    for (var q = 0; q < k; ++q) ss += s[i - 1];
  }
}
else ss += s[i - 1];

print(ss);

var n = parseInt(readline());
var s = readline();

function is_vowel(c) {
  return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y');
}

var ans = "";
for (var i = 0; i < n ; ) {
  if (is_vowel(s[i])) {
    var cnt = 0;
    var cur = s[i];
    var j;
    for (j = i; j < n; ++j) {
      if (s[j] != s[i]) break;
      cnt ++;
    }

    if (s[i] == 'e' || s[i] == 'o') {
      if (cnt == 2) {
        ans += cur + cur;
      }
      else {
        ans += cur;
      }
    }
    else {
      ans += cur;
    }
    i = j;
  }
  else {
     ans += s[i];
     i ++;
  }
}

print(ans)

function main() {
	    var n = readline(), str = readline();
var res = "";
for (var i=0; i<str.length; i++) {
	var c = str[i];
	if (c == "e" || c == "o") {
		var cnt = 0;

		while(i < str.length && str[i] == c) {cnt++; i++;}
		res += c;
		if (cnt == 2)
			res += c;
		i--;

    } else if (c == "a" || c == "i" || c == "u" || c == "y") {
		while(i < str.length && str[i] == c) { i++;}
		res += c;
		i--;

    } else {
		res += str[i];
    }
}

	    print(res);

}
main();

var n = parseInt(readline());
var s = "#" + readline() + "#";

var ans = "";
// var prev = s[0];

function isVowel(c) {
    return c == 'a' || c == 'e' || c == 'i' || c =='o' || c == 'u' || c == 'y';
}
var i = 1;
var count = 0;
while(i <= n) {
    //print(s[i])
    if(!isVowel(s[i])) {
        ans += s[i];
    } else {
        count = 1;
        while(s[i] == s[i + 1]) {
            count++;
            i++;
        }
        if((s[i] == 'e' || s[i] == 'o') && count == 2) {
            ans += s[i] + s[i];
        } else {
            ans += s[i];
        }

    }
    i++;
}

print(ans);

readline();
str = readline();

res = [];
word = "";
function addWord() {
    var ch = word.charAt(0);
    if ((ch == 'e' || ch == 'o') && word.length <= 2) {
        res.push(word);
    } else if (['e', 'a', 'i', 'o', 'u', 'y'].indexOf(ch) !== -1) {
        res.push(ch);
    } else {
        res.push(word);
    }
    word = '';
}
for (var i = 0; i < str.length; i++) {
    if (word == '' || word[0] === str[i]) {
        word += str[i];
    } else {
        addWord();
        word = str[i];
    }
}
addWord();

write(res.join(''));

n=+readline()
s=readline()

var l = 0
var pr = s[0]
var ans = ""
for(var i=0; i<=n; i++){
    if(i<n && s[i]==pr){
        l++;
    }else{
        if(l==2 && (pr=='e' || pr=='o')) l = 2
        else
        if(l>1 && (pr=='a' || pr=='e'|| pr=='i'|| pr=='o'|| pr=='u'|| pr=='y')) l = 1
        ans+=Array(l+1).join(pr)
        l = 1
    }
    if(i==n) break;
    pr = s[i]
}

print(ans)

var n = parseInt(readline());
s = readline().split('');
var i;
for (i = 1; i < n; i++) {
    var lowel = 0;
    if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u' || s[i] == 'y'){
        lowel = 1;
    }
    var start = i-1;
    while (i<n && s[i] == s[i-1] && lowel){
        i++;
    }
    if (s[start] == 'e' || s[start] == 'o'){
        if (i - start > 2){
            for(var j=start+1; j<i; j++){
                s[j] = '#';
            }
        }
    }
    else {
        if (i - start > 1){
            for(var j=start+1; j<i; j++){
                s[j] = '#';
            }
        }
    }
    // print(s);
    if (i - start > 1)
        i--;
}
output = ""
for (i = 0; i < n; i++) {
    if (s[i] != '#'){
        output += s[i];
    }
}
print(output);

var n = +readline() + 1;
var s = readline() + '1';
var prev = s.charAt(0);
var cnt = 1;
var answer = "";
for (i = 1; i < n; i++) {
    var c = s.charAt(i);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y' || c == '1') {
        if (c == prev) {
            cnt++;
        } else {
            if (cnt == 2 && (prev == 'e' || prev == 'o')) {
                answer += prev;
                answer += prev;
            } else {
                answer += prev;
            }
            prev = c;
            cnt = 1;
        }
    } else {
        if (cnt == 2 && (prev == 'e' || prev == 'o')) {
            answer += prev;
            answer += prev;
        } else {
            answer += prev;
        }
        prev = '';
        cnt = 0;
        answer += c;
    }
}
print(answer);

maybelength = +readline();
s = readline();
s = s.replace(/e{3,}/g,'e');
s = s.replace(/o{3,}/g,'o');
s = s.replace(/a{2,}/g,'a');
s = s.replace(/u{2,}/g,'u');
s = s.replace(/y{2,}/g,'y');
s = s.replace(/i{2,}/g,'i');
print(s);

x=+readline()
s=readline()
var curs="";
var result = "";
var count = 0;
for(i=0; i<x; i++) {
    if(isVowel(s[i])) {
        if(s[i] == curs) {
            count++;
            curs = "";
            curs += s[i];
        } else {
            result+=curs;
            if(count==2 && (curs=='e' || curs=='o')) result+=curs;
            curs=s[i];
            count = 1;
        }
    } else {
        result+=curs;
        if(count==2 && (curs=='e' || curs=='o')) result+=curs;
        curs="";
        count=0;
        result+=s[i];
    }
}
result+=curs;
if(count==2 && (curs=='e' || curs=='o')) result+=curs;

print(result);

function isVowel(a) {
    if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u'||a=='y') return true;
    return false;
}

var n = readline();
var s = readline();
var currO = false;
var currE = false;
for(var i = 0 ; i < s.length; i++){
    if(s[i] != 'o') currO = false;
    if(s[i] != 'e') currE = false;
    if(s[i] == 'a' && i +1 < s.length &&  s[i+1] == 'a') {
        s = s.slice(0,i) + s.slice(i+1,s.length);
        i--;
        continue;
    }
    if(s[i] == 'o' && ((i + 2 < s.length &&  s[i+1] == 'o' && s[i+2] == 'o') || (currO && i+1 < s.length && s[i+1] == 'o') )) {
        s = s.slice(0,i) + s.slice(i+1,s.length);
        i--;
        currO = true;
        continue;

    }
    if(s[i] == 'e' && ((i + 2 < s.length &&  s[i+1] == 'e' && s[i+2] == 'e') || (currE && i +1 < s.length && s[i+1] == 'e' ))) {
        s = s.slice(0,i) + s.slice(i+1,s.length);
        i--;
        currE = true;
        continue;
    }
    if(s[i] == 'i' && i+1 < s.length && s[i+1] == 'i') {
        s = s.slice(0,i) + s.slice(i+1,s.length);
        i--;
        continue;
    }
    if(s[i] == 'u' && i+1 < s.length && s[i+1] == 'u') {
        s = s.slice(0,i) + s.slice(i+1,s.length);
        i--;
        continue;
    }
    if(s[i] == 'y' && i+1 < s.length && s[i+1] == 'y') {
        s = s.slice(0,i) + s.slice(i+1,s.length);
        i--;
        continue;
    }
}
print(s);

readline();
str = readline();

res = "";
word = "";
function addWord() {
    if (word.length <= 2) {
        res += word;
    } else {
        res += word.charAt(0);
    }
    word = '';
}
for (var i = 0; i < str.length; i++) {
    if (word == '' || word[0] === str[i]) {
        word += str[i];
    } else {
        addWord();
        word = str[i];
    }
}
addWord();

write(res);

var n = readline();
var s = readline()

ss = s[0];

for (var i = 1; i < s.length; ++i) {
  if (s[i] != s[i - 1]) ss += s[i];
}

print(ss);


let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    for(i = 1; i <= t; i++){
        var a = lines[i].split(' ').map(Number);
        var n = a[0], k = a[1];
        if(k == 1 || n % 2 === 0){
            console.log('YES');
            var ans = '';
            for(j = 0; j < n; j++){
                for(l = 0; l < k; l++){
                    ans += j + 1 + l * n + ' ';
                }
                console.log(ans);
                ans = '';
            }
        }else{
            console.log('NO');
        }
    }
});

const yes = (n,k)=>{
     console.log("YES");
          for(let i=0;i<n;i++){
               let str="";
               let t = i+1;
               for(let j=0;j<k;j++){
                    str+=t+" ";
                    t+=n;
               }
               console.log(str);
          }
}
const solve = (n,k)=>{
     if((n===1)&&(k!==1)) console.log("NO");
     else if((k===1)) yes(n,k);
     else if(n%2===0) yes(n,k);
     else console.log("NO");
}
function main() {
  const fs = require("fs");
  const input = fs.readFileSync(0, "utf8").trim().split("\n");
  let line = 0;
  function readline() {
    return input[line++];
  }
  let t = parseInt(readline());
  for(let i=0;i<t;i++){
       let arr = readline().trim().split(" ").map(cur=>parseInt(cur));
       solve(arr[0],arr[1]);
  }
}
main();

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 T = rn();
	while (T--) {
		const [n, k] = rna();

		if (k == 1) {
			console.log('YES');
			for (let i = 0; i < n; i++) {
				console.log(i+1);
			}
		} else if ((n&1) == 0) {
			console.log('YES');
			for (let i = 0; i < n; i++) {
				const ar = [];
				for (let j = 0; j < k; j++) {
					ar.push(i + 1 + j*n);
				}
				console.log(ar.join(' '));
			}
		} else {
			console.log('NO');
		}
	}
}

//  Author:   old_school
//  Created:  08.02.2022 09:33:53

var t = readline();
function solve(flag) {
    var arr = [];
    for(var i = 1; i <= n*m; i++) {
        if (i % 2 == flag) {
            arr.push(i);
        }
        if(arr.length == m) {
            print(arr.join(' '));
            arr = [];
        }
    }
}
while(t--) {
    var c = readline().split(" ");
    var n = c[0], m = c[1];
    var even = Math.floor((n*m)/2);
    if (even % m) {
        print("NO");
        continue;
    }
    print("YES");
    solve(1);
    solve(0);
}

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 T = rn();
	while (T--) {
		const [n, k] = rna();

		if (k == 1 || (n&1) == 0) {
			console.log('YES');
			for (let i = 0; i < n; i++) {
				const ar = [];
				for (let j = 0; j < k; j++) {
					ar.push(i + 1 + j*n);
				}
				console.log(ar.join(' '));
			}
		} else {
			console.log('NO');
		}
	}
}

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 T = rn();
	while (T--) {
		const [n, k] = rna();

		if (k == 1) {
			console.log('YES');
			for (let i = 0; i < n; i++) {
				console.log(i+1);
			}
		} else if ((n&1) == 0) {
			console.log('YES');
			for (let i = 0; i < n; i++) {
				const ar = [];
				for (let j = 0; j < k; j++) {
					ar.push(i + 1 + j*k);
				}
				console.log(ar.join(' '));
			}
		} else {
			console.log('NO');
		}
	}
}

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 T = rn();
	while (T--) {
		const [n, k] = rna();

		if (k == 1) {
			console.log('YES');
			for (let i = 0; i < n; i++) {
				console.log(i+1);
			}
		} else if ((n&1) == 0) {
			console.log('YES');
			for (let i = 0; i < n; i++) {
				const ar = [];
				for (let j = 0; j < k; j++) {
					ar.push((i>>1)*k + j + 1);
				}
				console.log(ar.join(' '));
			}
		} else {
			console.log('NO');
		}
	}
}

const yes = (n,k)=>{
     console.log("YES");
          for(let i=0;i<n;i++){
               let str="";
               let t = i+1;
               for(let j=0;j<k;j++){
                    str+=t+" ";
                    t+=n;
               }
               console.log(str);
          }
}
const solve = (n,k)=>{
     if((n===1)&&(k!==1)) console.log("NO");
     else if((k===1)) yes(n,k);
     else if(n%2===0) yes(n,k);
     console.log("NO");
}
function main() {
  const fs = require("fs");
  const input = fs.readFileSync(0, "utf8").trim().split("\n");
  let line = 0;
  function readline() {
    return input[line++];
  }
  let t = parseInt(readline());
  for(let i=0;i<t;i++){
       let arr = readline().trim().split(" ").map(cur=>parseInt(cur));
       solve(arr[0],arr[1]);
  }
}
main();

const solve = (n,k)=>{
     if(k===1){
          console.log("YES");
          for(let i=0;i<n;i++) console.log(i+1);
     }
     else if((n===1)||(n%2===0)){
          console.log("YES");
          let cnt=2,start=0;
          for(let i=0;i<n;i++){
               let str="";
               if(cnt===0){
                    cnt = 2;
                    start = start + ((k-1)*2) + 1;
               }
               else start++;
               for(let j=0;j<k;j++) str+=start+(j*2)+" ";
               console.log(str);
               cnt--;
          }
     }
     else console.log("NO");
}
function main() {
  const fs = require("fs");
  const input = fs.readFileSync(0, "utf8").trim().split("\n");
  let line = 0;
  function readline() {
    return input[line++];
  }
  let t = parseInt(readline());
  for(let i=0;i<t;i++){
       let arr = readline().trim().split(" ").map(cur=>parseInt(cur));
       solve(arr[0],arr[1]);
  }
}
main();

//  Author:   old_school
//  Created:  08.02.2022 09:33:53

var t = readline().split("");
function solve(flag) {
    var arr = [];
    for(var i = 1; i <= n*m; i++) {
        if (i % 2 == flag) {
            arr.push(i);
        }
        if(arr.length == m) {
            print(arr.join(' '));
            arr = [];
        }
    }
}
while(t--) {
    var c = readline().split(" ");
    var n = c[0], m = c[1];
    var even = Math.floor((n*m)/2);
    if (even % m) {
        print("NO");
        continue;
    }
    print("YES");
    solve(1);
    solve(0);
}


var t = Number(readline());
var a = readline().split(' ').map(x=>Number(x));
var b = readline().split(' ').map(x=>Number(x));
var c = [];
for(var i=t-1;i>=0;i--)
 c[i] = a[i]-b[i];
c.sort(function(a,b){return b-a;});
var r=0;
var z=0;
for(;z<t;z++)
 if(c[z]<=0)
  break;

var i=z-1;
var j=z;
for(;i>=0;i--){
 for(;j<t;j++){
  if(c[j]+c[i]<=0)
   break;
 }
 r += j-i-1;
}
print(r);

'use strict'

const getLine = () => readline().split(' ')
const getInts = () => getLine().map(n => parseInt(n))
const getInt = () => getInts()[0]
const D = (...args) => { // D({name})
  [...args].forEach(cur => print.apply(print, [JSON.stringify(cur)]))
}

main()

function main() {
  const n = getInt()
  const ai = getInts()
  const bi = getInts()

  const arr = []
  for (let i = 0; i < n; ++i) {
    arr.push(ai[i] - bi[i])
  }

  arr.sort((a, b) => a - b)
  let ans = 0
  let l = 0
  let r = n - 1
  while (l < r) {
    while (l < r && arr[l] + arr[r] > 0) {
      r --
    }

    if (l == r) break
    ans += n - r - 1
    l ++
  }

  ans += sum(n - r)
  print(ans)
}

function sum (k) {
  return (k * (k - 1)) / 2
}

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

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

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

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(a) {
  return parseInt(a[ptr++])
}

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

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

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

function main(input) {
  const n = readInt(input)
  const a = readInts(input)
  const b = readInts(input)

  let diff = new Array(n)
  for(let i = 0; i < n; i++){
    diff[i] = a[i] - b[i]
  }
  sort(diff)
  // console.log(diff)
  let map = {}
  let ne = 0
  let ze = 0
  let po = 0
  for(let i = 0; i < n; i++){
    if(diff[i] === 0) ze++
    else if(diff[i] > 0) po++
    else ne++
  }
  let count = Math.abs(po * (po - 1) / 2)
  if(ze > 0) count += po * ze
  // console.log(count)
  let i
  for(i = 0; i < n && diff[i] < 0; i++){
    if(!map[diff[i]]) map[diff[i]] = 1
    else map[diff[i]]++
  }
  let k = i
  while(diff[k] === 0) k++
  i--
  // console.log(i, k)

  while(i >= 0 && k < n) {
    if(diff[i] > -diff[k]) {
      count += n - k
      i--
    }
    else k++
  }
  wr(count)
}

'use strict'

const getLine = () => readline().split(' ')
const getInts = () => getLine().map(n => parseInt(n))
const getInt = () => getInts()[0]
const D = (...args) => { // D({name})
  [...args].forEach(cur => print.apply(print, [JSON.stringify(cur)]))
}

main()

function main() {
  const n = getInt()
  const ai = getInts()
  const bi = getInts()

  const arr = []
  for (let i = 0; i < n; ++i) {
    arr.push(ai[i] - bi[i])
  }

  arr.sort((a, b) => a - b)
  let r = n - 1
  let ans = 0

  for (let l = 0; l < r; ++l) {
    while (r >= 0) {
      if (arr[r] + arr[l] <= 0) break
      r --
    }
    ans += n - r - 1
  }
  ans += sum(n - r)
  print(ans)
}

function sum (k) {
  return (k * (k - 1)) / 2
}

'use strict'

const getLine = () => readline().split(' ')
const getInts = () => getLine().map(n => parseInt(n))
const getInt = () => getInts()[0]
const D = (...args) => { // D({name})
  [...args].forEach(cur => print.apply(print, [JSON.stringify(cur)]))
}

main()

function main() {
  const n = getInt()
  const ai = getInts()
  const bi = getInts()

  const arr = []
  for (let i = 0; i < n; ++i) {
    arr.push(ai[i] - bi[i])
  }

  arr.sort((a, b) => a - b)
  let r = n - 1
  let ans = 0

  for (let l = 0; l < r; ++l) {
    while (r > 0) {
      if (arr[r] + arr[l] <= 0) break
      r --
    }
    if (arr[r] + arr[l] > 0) break
    ans += n - r - 1
  }

  ans += sum(n - r)
  print(ans)
}

function sum (k) {
  return (k * (k - 1)) / 2
}

'use strict'

const getLine = () => readline().split(' ')
const getInts = () => getLine().map(n => parseInt(n))
const getInt = () => getInts()[0]
const D = (...args) => { // D({name})
  [...args].forEach(cur => print.apply(print, [JSON.stringify(cur)]))
}

main()

function main() {
  const n = getInt()
  const ai = getInts()
  const bi = getInts()

  const arr = []
  for (let i = 0; i < n; ++i) {
    arr.push(ai[i] - bi[i])
  }

  arr.sort((a, b) => a - b)
  let l = n - 1
  while (l > 0 && arr[l] + arr[0] > 0) l --
  if (arr[l] + arr[0] <= 0) l ++

  const k = (n - l)
  let ans = l * k + ((k * (k - 1)) / 2)
  print(ans)
}

var t = Number(readline());
var a = readline().split(' ').map(x=>Number(x));
var b = readline().split(' ').map(x=>Number(x));
var c = [];
for(var i=t-1;i>=0;i--)
 c[i] = a[i]-b[i];
c.sort(function(a,b){return b-a;});
var r=0;
var z=0;
for(;z<t;z++)
 if(c[z]<=0)
  break;

var i=z-1;
var j=z;
for(;i>=0;i--){
 for(;j<t;j++){
  if(c[j]+c[i]<0)
   break;
 }
 r += j-i-1;
}
print(r);

var t = Number(readline());
var a = readline().split(' ').map(x=>Number(x));
var b = readline().split(' ').map(x=>Number(x));
var c = [];
for(var i=t-1;i>=0;i--)
 c[i] = a[i]-b[i];
c.sort(function(a,b){return b-a;});
print(c);
var r=0;
var z=0;
for(;z<t;z++)
 if(c[z]<=0)
  break;

var i=z-1;
var j=z;
for(;i>=0;i--){
 for(;j<t;j++){
  if(c[j]+c[i]<=0)
   break;
 }
 print(i,j);
 r += j-i-1;
}
print(r);

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

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

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

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(a) {
  return parseInt(a[ptr++])
}

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

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

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

function main(input) {
  const n = readInt(input)
  const a = readInts(input)
  const b = readInts(input)

  let diff = new Array(n)
  for(let i = 0; i < n; i++){
    diff[i] = a[i] - b[i]
  }
  sort(diff)
  // console.log(diff)
  let map = {}
  let ne = 0
  let ze = 0
  let po = 0
  for(let i = 0; i < n; i++){
    if(diff[i] === 0) ze++
    else if(diff[i] > 0) po++
    else ne++
  }
  let count = po * (po - 1) / 2
  if(ze > 0) count += po
  // console.log(count)
  let i
  for(i = 0; i < n && diff[i] < 0; i++){
    if(!map[diff[i]]) map[diff[i]] = 1
    else map[diff[i]]++
  }
  let k = i
  while(diff[k] === 0) k++
  i--
  // console.log(i, k)

  while(i >= 0 && k < n) {
    if(diff[i] > -diff[k]) {
      count += n - k
      i--
    }
    else k++
  }
  wr(count)
}

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

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

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

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(a) {
  return parseInt(a[ptr++])
}

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

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

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

function main(input) {
  const n = readInt(input)
  const a = readInts(input)
  const b = readInts(input)

  let diff = new Array(n)
  for(let i = 0; i < n; i++){
    diff[i] = a[i] - b[i]
  }
  sort(diff)
  // console.log(diff)
  let map = {}
  let ne = 0
  let ze = 0
  let po = 0
  for(let i = 0; i < n; i++){
    if(diff[i] === 0) ze++
    else if(diff[i] > 0) po++
    else ne++
  }
  let count = po * (po - 1) / 2
  if(ze > 0) count += po * ze
  // console.log(count)
  let i
  for(i = 0; i < n && diff[i] < 0; i++){
    if(!map[diff[i]]) map[diff[i]] = 1
    else map[diff[i]]++
  }
  let k = i
  while(diff[k] === 0) k++
  i--
  // console.log(i, k)

  while(i >= 0 && k < n) {
    if(diff[i] > -diff[k]) {
      count += n - k
      i--
    }
    else k++
  }
  wr(count)
}


var n=readline(); n=parseInt(n);
var arr=readline().split(' ').map(function(x){return parseInt(x)});
for(i = 0 ; i<n;i++)
{
    var num=0;
    for(var j=0;j<n;j++)
    if(arr[i]%2!=arr[j]%2)num++;
    if(num==n-1){print(i+1);}
}

var n=readline(); n=parseInt(n);
var arr=readline().split(' ').map(function(x){return parseInt(x)});
var even=0,odd=0; var Evenans=0 , Oddans=0;
for(var i=0;i<n;i++)
{
    if(arr[i]%2==0){even++; Evenans=i+1;}
    else {odd++; Oddans=i+1;}
}
if(even==1)print(Evenans);
else print(Oddans);

'use strict';

const getArray = (array_1, array_2) => {
    if (array_1.length === 1) {
        return array_1;
    }

    return array_2;
}

const filterOddNumbers = number => number % 2;
const filterEvenNumbers = number => number % 2 === 0;

const n = readline(),
      array = readline().split(' ').map(value => parseInt(value));

write(array.indexOf(getArray(
    array.filter(filterOddNumbers),
    array.filter(filterEvenNumbers)
)[0]) + 1);

var n = parseInt(readline());
var mas = readline();
mas = mas.split(" ");
var even = 0;
for(var i = 0; i < 3; ++i)
{
    if(parseInt(mas[i]) % 2 == 0){even ++;}
}
var i;
for(i = 0; i < n; ++i)
{
         if(even > 1 && parseInt(mas[i]) % 2 != 0){break;}
    else if(even < 2 && parseInt(mas[i]) % 2 == 0){break;}
}
print(i+1);

var n = Number(readline());
var s = readline().split(" ");
var k = 0, k1 = 0, res = 0, res1 = 0;
for (var i = 0; i<n; i++) {
    if (s[i] % 2 === 0) {
        k++;
        res = i;
    }
    else {
        k1++;
        res1 = i;
    }
}

if (k === 1) {
    print(res+1);
}
else {
    print(res1+1);
}

var n = readline();
var arr = readline().split(" ");
var chet = arr.filter(x=>x%2==0);

		for (var i=0; i<+n; i++){
			if(chet.length>1&&arr[i]%2!=0){
				print(i+1);
				break;
			}
			else if (chet.length==1&&arr[i]%2==0){
				print(i+1);
				break;
			}
		}

var x=parseInt(readline());
var arr=readline().split(' ');
var e=0,ev,od;
for(var i=0;i<x;i++)
{
   if(parseInt(arr[i])%2==0)
   {
       e+=1;
       ev=i;
   }
   else
{
    e-=1;
    od=i;
}
}
if(e>0)
{print(parseInt(od+1));
}else{
    print(parseInt(ev+1));
}

var temporary = readline();
var inputedNumbers = readline().split(' ');
var evenNumbers = [];
var notEvenNumbers = [];
var printed = false;
for (var index  = 0; index < inputedNumbers.length; index++)
    {
        if (isEven(+inputedNumbers[index]))
            {
               if (notEvenNumbers.length > 1)
               {
                   print(index+1);
                   printed = true;
                   break;
                }
               else
                   {
                       evenNumbers.push(index);
                   }
            }
         else
             {
                 if (evenNumbers.length > 1)
                     {
                         print(index+1);
                         printed = true;
                         break;
                         }
                  else
                      {
                          notEvenNumbers.push(index);
                          }

                 }
    }
if (evenNumbers.length > 1 && !printed)
    {
        print(notEvenNumbers[0]+1);
    }
else if(!printed)
    {
        print(evenNumbers[0]+1);
        }

function isEven(number)
{
    for(var counter = 2; ;)
        {
            if (number === 1)
                {
                    return false;
                    }
            else if ( !(number -= counter) )
                {
                    return true;
                }

       }
    return false;
}

var n = readline();
var data = readline().split(" ");

var count_o=0;
var last_e,last_o;
for(var i = 0; i < n; i++){
	if(data[i]&1){
		count_o++;
		last_o = i+1;
	}
	else
		last_e = i+1;

}
if(count_o == 1)
	print(last_o);
else
	print(last_e);

var n = readline();
var numbers = readline().split(' ');
findUniqueNumber();

function findUniqueNumber() {
    var isRemArr = [];
    var sumOfRes = 0;
    for (var i = 1; i < 2; i++) {
        var div = i + 1;
        for (var j = 0; j < numbers.length; j++) {
            if (numbers[j] % div !== 0) {
                isRemArr.push(1);
                sumOfRes++;
            } else {
                isRemArr.push(0);
            }
        }
        // print(isRemArr);
        var answer;
        if (sumOfRes === n - 1) {
            answer = isRemArr.indexOf(0);
        } else if (sumOfRes === 1) {
            answer = isRemArr.indexOf(1);
        }
        if (answer !== -1) {
            print(answer + 1);
            return;
        }
    }
}

var line = readline();
var n = parseInt(line);

var newnum = readline().split(' ').map(Number);

var oddcount=0;
var evencount=0;

for(i=0;i<n;i++){
    if(newnum[i]%2===0){
	evencount+=1;
    } else{
	oddcount+=1;
    }
}

if(oddcount===1){
    for(i=0;i<n;i++){
	if(newnum[i]%2===1){
	    print(i+1);
	}
    }
}else{
    for(i=0;i<n;i++){
	if(newnum[i]%2===0){
	    print(i+1);
	}
    }
}

n=parseInt(readline())
var odd, even;
X=readline().split(' ').map(i => parseInt(i)).reduce((a,c,i) => {
	if (c%2) odd=i; else even=i;
	return a + c%2
}, 0)
print((X===1?odd:even)+1)

var n = parseInt(readline());
var array = readline().split(' ').map(Number);
var even = [];
var odd = [];

for (var i = 0; i < n; i++) {
	if (array[i] % 2 == 0) {
		even.push(i);
	}
	else {
		odd.push(i);
	}
}

print (odd.length == 1 ? odd[0] + 1 : even[0] + 1);

var chetnie = [];
var nechetniye = [];
var num = parseInt(readline());
var numbers = readline().split(' ').map(function (num) {return parseInt(num)});

for (var i = 0; i < num; i++) {
	if (numbers[i] % 2 == 0) {
		chetnie.push(numbers[i]);
		lastChetnoye = i + 1;
	} else {
		nechetniye.push(numbers[i]);
		lastNechetnoye = i + 1;
	}
	if (chetnie.length > 1 && nechetniye.length == 1) {
		print(lastNechetnoye);
		break;
	}
	if (nechetniye.length > 1 && chetnie.length == 1) {
		print(lastChetnoye);
		break;
	}
}

	readline();var prm = readline().split(" ").map(function(m){if((+m)%2==0){return "z"}else{return "f"}});
		var r = 0;

	for(var i=0;i<prm.length;i++){
		if(prm[i]=="z"){r++}
        if(r==2){print((prm.indexOf("f")+1));break}
}
if(r!=2){print((prm.indexOf("z")+1))}

var n = Number(readline());

var arr = readline().split(" ");

var parity = arr.map(a => a % 2);
parity.sort();

var kontr = parity[1];
for(var i = 0; i < n; i++){
    if(kontr != arr[i] % 2){
        print(i + 1);
    }
}

readline()
var s=readline().split(' ').map(function(v){return v%2}).join('')
print(s.indexOf(s.match(/0/g).length<=1?0:1)+1)

var i1=0;
var i2=0;
var c1=0;
var c2=0;
readline();
readline().split(' ').map(Number).forEach(function(v, i){
	if(v%2){
		c1++;
		i1=i;
	}else{
		c2++;
		i2=i;
	}
});
print(c1>c2 ? i2+1 : i1+1);

readline();
var a=readline().split(' ').map(function(v){return v%2});
var s=0;
for(var i=0;i<3;i++){
	s+=a[i]%2;
}
print( a.indexOf( s>=2?0:1 ) + 1 );

var n = +readline(), numbers = readline().split(" ");

if(+numbers[0] % 2 == 0){
	if(+numbers[1] % 2 == 0){
		for(i = 2; i < n; i++){
			if(+numbers[i] % 2 == 1){
				write(i+1);
				break;
			}
		}
	}
	else{
		if(+numbers[2] % 2 == 0){
			write(2);
		}
		else{
			write(1);
		}
	}
}
else{
	if(+numbers[1] % 2 == 1){
		for(i = 2; i < n; i++){
			if(+numbers[i] % 2 == 0){
				write(i+1);
				break;
			}
		}
	}
	else{
		if(+numbers[2] % 2 == 1){
			write(2);
		}
		else{
			write(1);
		}
	}
}

var n = +readline();
var a = readline().split(' ').map(function(x) {return (+x) % 2;});
var sum = a.reduce(function(a, b) {return a + b});
var lookFor = sum == 1 ? 1 : 0;
for (var i = 0; i < n; i ++) if (a[i] == lookFor) print(i + 1);

var n = readline();
var s = readline().split(' ');

var i = 0;

var odd_n = 0;
var odd_x = 0;
var evenn = 0;
var evenx = 0;

for(i=0; i<n; i++)
{
  if(s[i]%2==0)
  {
    odd_n++;
    odd_x = i;
  }
  else
  {
    evenn++;
    evenx = i;
  }
}

if(odd_n == 1) print(odd_x+1);
else print(evenx+1);

var n = readline();
var s = readline().split(' ');

var i = 999;

var odd_n = 0;
var odd_x = 0;
var evenn = 0;
var evenx = 0;

for(i=0; i<n; i++)
{
  if(s[i]%2==0)
  {
    odd_n++;
    odd_x = i;
  }
  else
  {
    evenn++;
    evenx = i;
  }
}

if(odd_n == 1) print(odd_x+1);
else print(evenx+1);

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

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

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

function main() {
	var n = parseInt(readline());
	var integers = tokenizeIntegers(readline());
	var counts = [0, 0], last = new Array(2);
	for (var i = 0; i < n; i += 1) {
		counts[integers[i]%2] += 1;
		last[integers[i]%2] = i+1;
	}
	print(counts[0] == 1 ? last[0] : last[1]);
}

main();

//Read the input
const N = readline();
if (N <= 100 && N >= 3)
	input = readline();

//turn the string to array of intgers
input = input.split(' ').map((str) => {
	return parseInt(str);
});

index = 0; //index counter

//return as soon as the condition is true
input.some((num) => {
	index++;
	//Check weather the first number is the different one
	if ((input[1] % 2 === input[2] % 2) &&
		(input[1] % 2 !== input[0] % 2)) {
		return true;
	}
	//return when a number differs than the first number
	else {
		if (input[0] % 2 === 0)
			return num % 2 !== 0;
		else
			return num % 2 === 0;
	}
});

print(index);

'use strict'

let lll = readline()

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

let fe = ns[0] % 2
let se = ns[1] % 2
let te = ns[2] % 2

let ae = +(fe + se + te >= 2)

;(function () {
  for (let i = 0; i < ns.length; i++) {
    if (ns[i] % 2 != ae) return print(i + 1)
  }
})()

    var n=readline()
    var a=readline()
    var e=0,o=0,pose=0,poso=0;
    var arr=new Array();
    var st="";
    for(var i=0;i<a.length;++i){
        if (a[i]!=' ')st+=a[i]
        else{
            arr.push(st)
            if (st&1){o++;poso=arr.length}
            else {e++;pose=arr.length}
            st=""
        }
    }
    arr.push(st)
    if (st&1){o++;poso=arr.length}
    else{e++;pose=arr.length}
    print(o<=1?poso:pose)

process.stdin.setEncoding("ascii");
let input = "";
process.stdin.on("data", data => input += data);
process.stdin.on("end", () => {
    const parities = input.split("\n")[1].split(" ").map(Number).map(x => x % 2);
    if (parities.reduce((a, b) => a + b) > 1)
    {
        console.log(parities.indexOf(0) + 1);
    } else {
        console.log(parities.indexOf(1) + 1);
    }
});

const readline = require('readline');

let secondLine = false;

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

let inputs = [];

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

// Read Inputs
rl.on('close', () => {
    const n = parseInt(inputs[0]);
    const numbers = inputs[1].split(' ').map(number => parseInt(number));
    let chages = 0;

    for (let i = 1; i < numbers.length; i++) {

        if (numbers[i] % 2 != numbers[0] % 2)
            chages++;

        // if the change occurred early
        if (i == 1 && chages == 1) {
            if (numbers[i] % 2 == numbers[i + 1] % 2)
                return console.log(1)
            else
                return console.log(2)
        }

        //
        if (i > 1 && chages == 1) {
            return console.log(i + 1)
        }

    }

});

const input = [];

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

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

RL.on('close', () => {
    const nums = input[1].split(' ').map(x => parseInt(x));
    const cnt = [0, 0];

    nums.forEach((x, i) => {
      if (x % 2 === 0) cnt[0] += 1;
      else cnt[1] += 1;
      if (i === 2) return;
    });

    nums.forEach( (x, i) => {
      if (cnt[0] > cnt[1] && x % 2 !== 0) {
        console.log(i+1); return;
      } else if (cnt[1] > cnt[0] && x % 2 === 0) {
        console.log(i+1); return;
      }
    });
});

const input = [];

function splitAndParseInt(line) {
  return line.split(" ").map((x) => parseInt(x));
}

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

readLine.on("line", (line) => {
  input.push(line);
});

readLine.on("close", () => {
  const nums = splitAndParseInt(input[1]);
  let cntOdd = (nums[0] % 2 !== 0) + (nums[1] % 2 !== 0) + (nums[2] % 2 !== 0);

  for (let i = 0; i < nums.length; i += 1) {
    let n = nums[i];
    if (cntOdd <= 1 && n % 2 !== 0) {
      console.log(i + 1);
      return;
    } else if (cntOdd > 1 && n % 2 === 0) {
      console.log(i + 1);
      return;
    }
  }
});

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] = input[0].split(' ').map(Number);
    const arr = input[1].split(' ').map(Number);
    const evens = [], odds = [];
    arr.forEach((v, i) => v % 2 === 0 ? evens.push(i + 1) : odds.push(i + 1));
    if (evens.length === 1) console.log(evens[0]);
    else console.log(odds[0]);
});

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 += 2) {
    doit(txt[i + 1].split(" ").filter(data => data.length > 0).map(data => data * 1));
}

function doit(tab) {
    let t = tab.filter(data => data % 2 === 0);
    if (t.length == 1) {
        console.log(tab.indexOf(t[0]) + 1);
    } else {
        console.log(tab.indexOf(tab.filter(data => data % 2 == 1)[0]) + 1);
    }

}

print((d => 1 + d.findIndex(x => x % 2 == d.reduce((d, x) => d.splice(x%2, 1, d[x%2]+1) && d, [0, 0]).indexOf(1)))((readline() && readline()).toString().split(/\s+/).map(Number)))

var n = parseInt(readline());
var arr = readline().split(' ').map(el => parseInt(el)),
    even=0, odd=0, index=0;
for (var i = 0; i < arr.length; i++) {
    if (arr[i] % 2 == 0) {
        even++;
    } else {
        odd++;
    }
}
if (even < odd) {
    for (var j = 0; j < arr.length; j++) {
        if(arr[j] % 2 == 0){
            index = j;
        }
    }
} else {
    for (var a = 0; a < arr.length; a++) {
        if(arr[a] % 2 != 0){
            index = a;
        }
    }
}
print(index+1);

var n = readline();
var s = readline().split(' ');

var i = 0;

var odd_n = 0;
var odd_x = 0;
var evenn = 0;
var evenx = 0;

for(i=0; i<n; i++)
{
  if(s[i]%2==0)
  {
    odd_n++;
    odd_x = i;
  }
  else
  {
    evenn++;
    evenx = i;
  }
}

if(odd_n == 1) print(odd_x);
else print(evenx);

const N = readline();
if (N <= 100 && N >= 3)
	input = readline();

//turn the string to array of intgers
input = input.split(' ').map((str) => {
	return parseInt(str);
});

var index = 0; //index counter
var firstNum = input[0]; //first num of the array

//return as soon as the condition is true
input.some((num) => {
	index++;
	if (firstNum % 2 === 0)
		return num % 2 !== 0;
	else
		return num % 2 === 0;
});

print(index);

var n=readline()
var arr=readline()
var ev=0,od=0,pose=-1,poso=-1
for(var i=0;i<n;++i){
    if (arr[i]&1){od++;poso=i;}
    else {ev++;pose=i}
}
print(ev==1?pose:poso)

var n=readline()
var arr=readline()
print(arr[0])

var n=readline()
var arr=readline()
var ev=0,od=0,pose=-1,poso=-1
for(var i=0;i<n;++i){
    if (arr[i]&1){od++;poso=i;}
    else {ev++;pose=i}
}
print(ev==1?arr[pose]:arr[poso])

var n=readline()
var arr=readline().split(' ').join('')
var e=0,o=0,pe=0,po=0;
for(var i=0;i<n;++i){
    if ((arr[i]&1)){o++;po=i}
    else {e++;pe++;}
}
print(e==1?pe+1:po+1)

const readline = require('readline');

let secondLine = false;

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

let inputs = [];

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

// Read Inputs
rl.on('close', () => {
    const n = parseInt(inputs[0]);
    const numbers = inputs[1].split(' ').map(number => parseInt(number));
    let numberIdx = 1;
    let base = Math.ceil(numbers[0] % 2);

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

        if (Math.ceil(numbers[i] % 2) != base)
            return console.log(numberIdx);

        numberIdx++;
    }

});

const input = [];

function splitAndParseInt(line) {
  return line.split(" ").map((x) => parseInt(x));
}

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

readLine.on("line", (line) => {
  input.push(line);
});

readLine.on("close", () => {
  const nums = splitAndParseInt(input[1]);
  let cntOdd = (nums[0] % 2 !== 0) + (nums[1] % 2 !== 0) + (nums[2] % 2 !== 0);

  for (let i = 0; i < nums.length; i += 1) {
    let n = nums[i];
    if (cntOdd === 1 && n % 2 !== 0) {
      console.log(i + 1);
      return;
    } else if (cntOdd > 1 && n % 2 === 0) {
      console.log(i + 1);
      return;
    }
  }
});

    var n=readline()
    var a=readline()
    var e=0,o=0,pose=0,poso=0;
    var arr=new Array();
    var st="";
    for(var i=0;i<a.length;++i){
        if (a[i]!=' ')st+=a[i]
        else{
            arr.push(st)
            if (st&1){o++;poso=arr.length}
            else {e++;pose=arr.length}
            st=""
        }
    }
    arr.push(st)
    print(o<=1?poso:pose)

var n=readline()
var arr=readline().split(' ').join('')
var e=0,o=0,pe=0,po=0;
for(var i=0;i<n;++i){
    if ((arr[i]&1)){o++;po=i;}
    else {e++;pe=i;}
}
print((e==1?pe+1:po+1))

var n=readline()
var arr=readline().split(' ').join('')
var e=0,o=0,pe=0,po=0;
for(var i=0;i<n;++i){
    if ((arr[i]&1)){o++;po=i;}
    else {e++;pe=i;}
    print(arr[i])
}
print((e==1?pe+1:po+1))

print((d => 1 + d.findIndex(x => x % 2 == d.reduce((d, x) => d.splice(x%2, 1, d[x%2]+1) && d, [0, 0]).indexOf(1)))((readline() && readline()).toString().split(/\s+/).slice(1).map(Number)))

'use strict';

const getArray = (array_1, array_2) => {
    if (array_1.length === 1) {
        return array_1;
    }

    return array_2;
}

const filterOddNumbers = number => number % 2;
const filterEvenNumbers = number => number % 2 === 0;

const n = readline(),
      array = readline().split(' ').map(value => parseInt(value));

write(array.indexOf(getArray(
    array.map(filterOddNumbers),
    array.map(filterEvenNumbers)
)[0]) + 1);

var n = readline();
var str = readline().split(" ");
var nc =0; c=0;
	for (var i=0; i<n; i++){
		if (str[i]%2==0)
			c++;
		else nc++;
	}
c>nc? print(nc):print(c);

var n = readline();
var str = readline().split(" ");
var chet = 0;
if ((Number(str[0])+Number(str[1]))%2==0||(Number(str[1])+Number(str[2]))%2==0)
	chet=1;
	for (var i=0; i<n; i++){
			if(chet!=0&&str[i]%2!=0){
		print(i+1);
			break;}
			else if (chet==0&&str[i]%2==0){
			print(i+1);
			break;
		}
	}

var x=parseInt(readline());
var arr=readline().split(' ');
var e=0,ev,od,o=0;
for(var i=0;i<x;i++)
{
   if(parseInt(arr[i])%2==0)
   {
       e+=1;
       ev=i;
   }
   else
{
    o+=1;
    od=i;
}
}
if(e>0)
{print(parseInt(ev+1));
}else{
    print(parseInt(od+1));
}

var x=parseInt(readline());
var arr=readline().split(' ');
var e=0,ev,od;
for(var i=0;i<x;i++)
{
   if(parseInt(arr[i])%2==0)
   {
       e+=1;
       ev=i;
   }
   else
{
    e-=1;
    od=i;
}
}
if(e>0)
{print(parseInt(ev+1));
}else{
    print(parseInt(od+1));
}

var n = Number(readline());
var s = readline().split(" ");

var k = 0, k1 = 0, res = 0, res1 = 0;
for (var i = 1; i<n; i++) {
    if (s[i] % 2 === 0) {
        k++;
        res = i;
    }
    else {
        k1++;
        res1 = i;
    }
}

if (k === 1) {
    print(res+1);
}
else {
    print(res1+1);
}

var n = readline();
var numbers = readline().split(' ');

findUniqueNumber();

function findUniqueNumber() {

    var redundantStack = [];

for (var i = 1; i < 3; i++) { // find divider

  var div = i+1;
  var redundantCount = 0; // with remainder count

    for (var j = 0; j < numbers.length; j++) {

        // print('test %: ', numbers[j], div, numbers[j] % div);
        // print('test /: ', numbers[j], div, numbers[j] / div);
        // || numbers[j] / div > 1

        if (numbers[j] % div !== 0 ) {

            redundantCount++;
            redundantStack.push(j);
        } else {
            var specialInd = j;
        }
    }
    // print('redundantCount : ', redundantCount);
    if (redundantCount === 1) {
        var lastInd = redundantStack.length - 1;
        print(redundantStack[lastInd] + 1); // answer
        return;
    } else if (redundantCount === numbers.length - 1) {
        print(redundantStack[specialInd]); // answer
        return;
    }
}

}

var n = parseInt(readline());
var array = readline().split(' ').map(Number);
var even = [];
var odd = [];

for (var i = 0; i < 3; i++) {
	if (array[i] % 2 == 0) {
		even.push(array[i]);
	}
	else {
		odd.push(array[i]);
	}
}

print (odd.length == 1 ? odd[0] : even[0]);

var n = parseInt(readline());
var array = readline().split(' ').map(Number);
var even = [];
var odd = [];

for (var i = 0; i < 3; i++) {
	if (array[i] % 2 == 0) {
		even.push(i);
	}
	else {
		odd.push(i);
	}
}

print (odd.length == 1 ? odd[0] + 1 : even[0] + 1);


'use strict';

var fs = require('fs');

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

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(read) {
  const [rn, rb, rns, re, rbs] = convertInput(read);
  const n = rn(),
        a = rns();
  const l = [a[0]];
  for (let i = 1; i < n; i++) {
    if (i & 1) {
      l[i] = l[i - 1] - a[i];
    } else {
      l[i] = l[i - 1] + a[i];
    }
  }
  const r = [];
  r[n - 1] = a[n - 1];
  const odd = new Map(),
        even = new Map();
  for (let i = n - 1; i >= 0; i--) {
    if (i < n - 1) {
      if (n - i - 1 & 1) {
        r[i] = a[i] - r[i + 1];
      } else {
        r[i] = a[i] - r[i + 1];
      }
    }
    if (i & 1) {
      if (!odd.has(r[i])) odd.set(r[i], []);
      odd.get(r[i]).push(i);
    } else {
      if (!even.has(r[i])) even.set(r[i], []);
      even.get(r[i]).push(i);
    }
  }
  for (let [key, arr] of odd) arr.reverse();
  for (let [key, arr] of even) arr.reverse();
  const find = arr => {
    while (arr.length && arr[arr.length - 1] > right) arr.pop();
    if (arr.length && arr[arr.length - 1] > left) {
      const ans = arr[arr.length - 1];
      pre = r[ans];
      sum = d = 0;
      res.push([pl, left], [ans, right]);
      right = ans - 1;
      pl = left + 1;
      return true;
    }
    return false;
  };
  let sum = 0,
      pre = 0,
      res = [];
  let left = 0,
      right = n - 1,
      d = 0,
      pl = 0;
  for (; left <= right; left++) {
    if (d & 1) {
      sum -= a[left];
    } else {
      sum += a[left];
    }
    if (sum === 0) {
      res.push([pl, left]);
      pl = left + 1;
      sum = d = 0;
      continue;
    }
    d++;
    if (right & 1) {
      let t = -sum - pre;
      if (odd.has(t)) {
        if (find(odd.get(t))) {
          continue;
        }
      }
      t = -sum + pre;
      if (even.has(t)) {
        if (find(even.get(t))) {
          continue;
        }
      }
    } else {
      let t = -sum - pre;
      if (even.has(t)) {
        if (find(even.get(t))) {
          continue;
        }
      }
      t = -sum + pre;
      if (odd.has(t)) {
        if (find(odd.get(t))) {
          continue;
        }
      }
    }
  }
  res.sort((a, b) => a[0] - b[0]);
  const check = arr => {
    var _arr$, _arr;
    if (((_arr$ = arr[0]) === null || _arr$ === void 0 ? void 0 : _arr$[0]) !== 0 || ((_arr = arr[arr.length - 1]) === null || _arr === void 0 ? void 0 : _arr[1]) !== n - 1) return false;
    for (let i = 1; i < arr.length; i++) {
      if (arr[i][0] !== arr[i - 1][1] + 1) return false;
    }
    return true;
  };
  if (!check(res)) return -1;
  return `${res.length}\n${res.map(arr => arr.map(num => num + 1).join(' ')).join('\n')}`;
}
function convertInput(read) {
  const rn = () => Number(read());
  const rb = () => BigInt(read());
  const rns = () => read().split(/\s+/).map(Number);
  const re = () => read().split(/\s+/).map(s => Number(s) - 1);
  const rbs = () => read().split(/\s+/).map(BigInt);
  return [rn, rb, rns, re, rbs];
}
function main(r) {
  try {
    let t = Number(r());
    let res = new Array(t);
    let limit = 0;
    for (let i = 0; i < t; i++) {
      var _solve;
      const s = (_solve = solve(r)) !== null && _solve !== void 0 ? _solve : '';
      if (t < limit) {
        process.stdout.write(s.toString());
        process.stdout.write('\n');
      } else {
        res[i] = s;
      }
    }
    if (t >= limit) {
      return res.join('\n');
    } else {
      return '';
    }
  } catch (error) {
    console.log(error);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split(/\r?\n/);
void function () {
  const read = ((i = 0) => () => inputs[i++])();
  const output = main(read);
  process.stdout.write(output);
}();

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 = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr) {
    const sum = arr.reduce((s, x) => s + x, 0)
    // if (!sum) {
    //     return `1\n1 ${n}`
    // }
    const t = sum > 0 ? 1 : -1
    let k = sum / t
    if (k & 1) return -1
    k /= 2
// console.log('k', k)
    const use = Array(n)
    const ans = []
    for (let i = 1; i < arr.length; i++) {
        if (k > 0 && arr[i] === t && !use[i - 1]) {
            use[i - 1] = 1
            use[i] = 1
            // ans.push([i - 1, i])
            ans.push([i, i + 1])
            k--
        }
    }
    if (k > 0) return -1
    for (let i = 0; i < arr.length; i++) {
        if (!use[i]) {
            ans.push([i + 1, i + 1])
        }
    }
    ans.sort((a, b) => a[0] - b[0])
    return ans.length + '\n' + ans.map(x => x.join(' ')).join('\n')
}

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 = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr) {
    const sum = arr.reduce((s, x) => s + x, 0)
    // if (!sum) {
    //     return `1\n1 ${n}`
    // }
    const t = sum > 0 ? 1 : -1
    let k = sum / t
    if (k & 1) return -1
    k /= 2
// console.log('k', k)
    const use = Array(n)
    const ans = []
    for (let i = 1; i < arr.length; i++) {
        if (k > 0 && arr[i] === t && !use[i - 1]) {
            use[i - 1] = 1
            use[i] = 1
            // ans.push([i - 1, i])
            ans.push(`${i} ${i + 1}`)
            k--
        }
    }
    if (k > 0) return -1
    for (let i = 0; i < arr.length; i++) {
        if (!use[i]) {
            ans.push(`${i + 1} ${i + 1}`)
        }
    }
    ans.unshift(ans.length)
    return ans.join('\n')
}

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 = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr) {
    const sum = arr.reduce((s, x) => s + x, 0)
    // if (!sum) {
    //     return `1\n1 ${n}`
    // }
    const t = sum > 1 ? 1 : -1
    let k = sum / t
    if (k & 1) return -1
    k /= 2
// console.log('k', k)
    const use = Array(n)
    const ans = []
    for (let i = 1; i < arr.length; i++) {
        if (k > 0 && arr[i] === t && !use[i - 1]) {
            use[i - 1] = 1
            use[i] = 1
            // ans.push([i - 1, i])
            ans.push(`${i} ${i + 1}`)
            k--
        }
    }
    if (k > 0) return -1
    for (let i = 0; i < arr.length; i++) {
        if (!use[i]) {
            ans.push(`${i + 1} ${i + 1}`)
        }
    }
    ans.unshift(ans.length)
    return ans.join('\n')
}

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 = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr) {
    const sum = arr.reduce((s, x) => s + x, 0)
    if (!sum) {
        return `1\n1 ${n}`
    }
    const t = sum > 1 ? 1 : -1
    let k = sum / t
    if (k & 1) return -1
    k /= 2
// console.log('k', k)
    const use = Array(n)
    const ans = []
    for (let i = 1; i < arr.length; i++) {
        if (k > 0 && arr[i] === t && !use[i - 1]) {
            use[i - 1] = 1
            use[i] = 1
            // ans.push([i - 1, i])
            ans.push(`${i} ${i + 1}`)
            k--
        }
    }
    if (k > 0) return -1
    for (let i = 0; i < arr.length; i++) {
        if (!use[i]) {
            ans.push(`${i + 1} ${i + 1}`)
        }
    }
    ans.unshift(ans.length)
    return ans.join('\n')
}

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 = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr) {
    const sum = arr.reduce((s, x) => s + x, 0)
    if (!sum) {
        return '1\n1 n'
    }
    const t = sum > 1 ? 1 : -1
    let k = sum / t
    if (k & 1) return -1
    k /= 2
// console.log('k', k)
    const use = Array(n)
    const ans = []
    for (let i = 1; i < arr.length; i++) {
        if (k > 0 && arr[i] === t && !use[i - 1]) {
            use[i - 1] = 1
            use[i] = 1
            // ans.push([i - 1, i])
            ans.push(`${i} ${i + 1}`)
            k--
        }
    }
    if (k > 0) return -1
    for (let i = 0; i < arr.length; i++) {
        if (!use[i]) {
            ans.push(`${i + 1} ${i + 1}`)
        }
    }
    ans.unshift(ans.length)
    return ans.join('\n')
}

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 = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr) {
    const sum = arr.reduce((s, x) => s + x, 0)
    if (!sum) {
        return '1\n1 n'
    }
    const t = sum > 1 ? 1 : -1
    let k = sum / t
    if (k & 1) return -1
    k /= 2
    const use = Array(n)
    const ans = []
    for (let i = 1; i < arr.length; i++) {
        if (arr[i] === t && !use[i - 1]) {
            use[i - 1] = 1
            use[i] = 1
            // ans.push([i - 1, i])
            ans.push(`${i} ${i + 1}`)
            k--
        }
    }
    if (k > 0) return -1
    for (let i = 0; i < arr.length; i++) {
        if (!use[i]) {
            ans.push(`${i + 1} ${i + 1}`)
        }
    }
    ans.unshift(ans.length)
    return ans.join('\n')
}

'use strict';

var fs = require('fs');

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

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(read) {
  const [rn, rb, rns, re, rbs] = convertInput(read);
  const n = rn(),
        a = rns();
  const l = [a[0]];
  for (let i = 1; i < n; i++) {
    if (i & 1) {
      l[i] = l[i - 1] - a[i];
    } else {
      l[i] = l[i - 1] + a[i];
    }
  }
  const r = [];
  r[n - 1] = a[n - 1];
  const odd = new Map(),
        even = new Map();
  for (let i = n - 1; i >= 0; i--) {
    if (i < n - 1) {
      if (n - i - 1 & 1) {
        r[i] = a[i] - r[i + 1];
      } else {
        r[i] = a[i] - r[i + 1];
      }
    }
    if (i & 1) {
      if (!odd.has(r[i])) odd.set(r[i], []);
      odd.get(r[i]).push(i);
    } else {
      if (!even.has(r[i])) even.set(r[i], []);
      even.get(r[i]).push(i);
    }
  }
  for (let [key, arr] of odd) arr.reverse();
  for (let [key, arr] of even) arr.reverse();
  const find = arr => {
    while (arr.length && arr[arr.length - 1] > right) arr.pop();
    if (arr.length && arr[arr.length - 1] > left) {
      const ans = arr[arr.length - 1];
      pre = r[ans];
      sum = d = 0;
      res.push([pl, left], [ans, right]);
      right = ans - 1;
      pl = left + 1;
      return true;
    }
    return false;
  };
  let sum = 0,
      pre = 0,
      res = [];
  let left = 0,
      right = n - 1,
      d = 0,
      pl = 0;
  for (; left < right; left++) {
    if (d & 1) {
      sum -= a[left];
    } else {
      sum += a[left];
    }
    d++;
    if (right & 1) {
      let t = -sum - pre;
      if (odd.has(t)) {
        if (find(odd.get(t))) {
          continue;
        }
      }
      t = -sum + pre;
      if (even.has(t)) {
        if (find(even.get(t))) {
          continue;
        }
      }
    } else {
      let t = -sum - pre;
      if (even.has(t)) {
        if (find(even.get(t))) {
          continue;
        }
      }
      t = -sum + pre;
      if (odd.has(t)) {
        if (find(odd.get(t))) {
          continue;
        }
      }
    }
  }
  res.sort((a, b) => a[0] - b[0]);
  const check = arr => {
    var _arr$, _arr;
    if (((_arr$ = arr[0]) === null || _arr$ === void 0 ? void 0 : _arr$[0]) !== 0 || ((_arr = arr[arr.length - 1]) === null || _arr === void 0 ? void 0 : _arr[1]) !== n - 1) return false;
    for (let i = 1; i < arr.length; i++) {
      if (arr[i][0] !== arr[i - 1][1] + 1) return false;
    }
    return true;
  };
  if (!check(res)) return -1;
  return `${res.length}\n${res.map(arr => arr.map(num => num + 1).join(' ')).join('\n')}`;
}
function convertInput(read) {
  const rn = () => Number(read());
  const rb = () => BigInt(read());
  const rns = () => read().split(/\s+/).map(Number);
  const re = () => read().split(/\s+/).map(s => Number(s) - 1);
  const rbs = () => read().split(/\s+/).map(BigInt);
  return [rn, rb, rns, re, rbs];
}
function main(r) {
  try {
    let t = Number(r());
    let res = new Array(t);
    let limit = 0;
    for (let i = 0; i < t; i++) {
      var _solve;
      const s = (_solve = solve(r)) !== null && _solve !== void 0 ? _solve : '';
      if (t < limit) {
        process.stdout.write(s.toString());
        process.stdout.write('\n');
      } else {
        res[i] = s;
      }
    }
    if (t >= limit) {
      return res.join('\n');
    } else {
      return '';
    }
  } catch (error) {
    console.log(error);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split(/\r?\n/);
void function () {
  const read = ((i = 0) => () => inputs[i++])();
  const output = main(read);
  process.stdout.write(output);
}();

'use strict';

var fs = require('fs');

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

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(read) {
  const [rn, rb, rns, re, rbs] = convertInput(read);
  const n = rn(),
        a = rns();
  const l = [a[0]];
  for (let i = 1; i < n; i++) {
    if (i & 1) {
      l[i] = l[i - 1] - a[i];
    } else {
      l[i] = l[i - 1] + a[i];
    }
  }
  const r = [];
  r[n - 1] = a[n - 1];
  const odd = new Map(),
        even = new Map();
  for (let i = n - 1; i >= 0; i--) {
    if (i < n - 1) {
      if (n - i - 1 & 1) {
        r[i] = a[i] - r[i + 1];
      } else {
        r[i] = a[i] - r[i + 1];
      }
    }
    if (i & 1) {
      if (!odd.has(r[i])) odd.set(r[i], []);
      odd.get(r[i]).push(i);
    } else {
      if (!even.has(r[i])) even.set(r[i], []);
      even.get(r[i]).push(i);
    }
  }
  for (let [key, arr] of odd) arr.reverse();
  for (let [key, arr] of even) arr.reverse();
  const find = arr => {
    while (arr.length && arr[arr.length - 1] > right) arr.pop();
    if (arr.length && arr[arr.length - 1] > left) {
      const ans = arr[arr.length - 1];
      pre = r[ans];
      sum = d = 0;
      res.push([pl, left], [ans, right]);
      right = ans - 1;
      pl = left + 1;
      return true;
    }
    return false;
  };
  let sum = 0,
      pre = 0,
      res = [];
  let left = 0,
      right = n - 1,
      d = 0,
      pl = 0;
  for (; left < right; left++) {
    if (d & 1) {
      sum -= a[left];
    } else {
      sum += a[left];
    }
    d++;
    if (right & 1) {
      let t = -sum - pre;
      if (odd.has(t)) {
        if (find(odd.get(t))) {
          continue;
        }
      }
      t = -sum + pre;
      if (even.has(t)) {
        if (find(even.get(t))) {
          continue;
        }
      }
    } else {
      let t = -sum - pre;
      if (even.has(t)) {
        if (find(even.get(t))) {
          continue;
        }
      }
      t = -sum + pre;
      if (odd.has(t)) {
        if (find(odd.get(t))) {
          continue;
        }
      }
    }
  }
  res.sort((a, b) => a[0] - b[0]);
  const check = arr => {
    var _arr$, _arr;
    if (((_arr$ = arr[0]) === null || _arr$ === void 0 ? void 0 : _arr$[0]) !== 0 || ((_arr = arr[arr.length - 1]) === null || _arr === void 0 ? void 0 : _arr[1]) !== n - 1) return false;
    for (let i = 1; i < arr.length; i++) {
      if (arr[i][0] !== arr[i - 1][1] + 1) return false;
    }
    return true;
  };
  if (!check(res)) return -1;
  return `${res.length}\n${res.map(arr => arr.join(' ')).join('\n')}`;
}
function convertInput(read) {
  const rn = () => Number(read());
  const rb = () => BigInt(read());
  const rns = () => read().split(/\s+/).map(Number);
  const re = () => read().split(/\s+/).map(s => Number(s) - 1);
  const rbs = () => read().split(/\s+/).map(BigInt);
  return [rn, rb, rns, re, rbs];
}
function main(r) {
  try {
    let t = Number(r());
    let res = new Array(t);
    let limit = 0;
    for (let i = 0; i < t; i++) {
      var _solve;
      const s = (_solve = solve(r)) !== null && _solve !== void 0 ? _solve : '';
      if (t < limit) {
        process.stdout.write(s.toString());
        process.stdout.write('\n');
      } else {
        res[i] = s;
      }
    }
    if (t >= limit) {
      return res.join('\n');
    } else {
      return '';
    }
  } catch (error) {
    console.log(error);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split(/\r?\n/);
void function () {
  const read = ((i = 0) => () => inputs[i++])();
  const output = main(read);
  process.stdout.write(output);
}();


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

const solution = () => {
	let line = data.split('\n');
	let n = parseInt(line[0],10);
	let a = line[1].split(' ').map(i => parseInt(i,10));
	let m = parseInt(line[2],10);
	let q = line[3].split(' ').map(i => parseInt(i,10));
	let r = [];
	let s = a.reduce((w, c) => w + c);
	a.sort((a, b) => b - a);
	for(let i of q){
		r.push(s - a[i-1]);
	}
	console.log(r.join('\n'));
};

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

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

const solution = () => {
	let line = data.split('\n');
	let n = Number(line.shift());
	let a = line.shift().split(' ').map(i => Number(i));
	let m = Number(line.shift());
	let q = line.shift().split(' ').map(i => Number(i));
	let r = [];
	let s = a.reduce((w, c) => w + c);
	a.sort((a, b) => b - a);
	for(let i of q){
		r.push(s - a[i-1]);
	}
	console.log(r.join('\n'));
};

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

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

const solution = () => {
	let line = data.split('\n');
	let n = parseInt(line.shift(),10);
	let a = line.shift().split(' ').map(i => parseInt(i,10));
	let m = parseInt(line.shift(),10);
	let q = line.shift().split(' ').map(i => parseInt(i,10));
	let r = [];
	let s = a.reduce((w, c) => w + c);
	a.sort((a, b) => b - a);
	for(let i of q){
		r.push(s - a[i-1]);
	}
	console.log(r.join('\n'));
};

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


"use strict";

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

let inputString = "";
let currentLine = 0;

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

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

  main();
});

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

const findIndex = (N, M, A, target) => {
  for (let r = 0; r < N; r += 1) {
    for (let c = 0; c < M; c += 1) {
      if (A[r][c] == target) {
        return [r, c];
      }
    }
  }

  return [-1, -1];
};

const getNeibs = (N, M, A, R, C) => {
  const neibs = [];
  for (const [nr, nc] of [
    [R + 1, C],
    [R - 1, C],
    [R, C + 1],
    [R, C - 1],
  ]) {
    if (0 <= nr && nr < N && 0 <= nc && nc < M && A[nr][nc] == ".") {
      neibs.push([nr, nc]);
    }
  }

  return neibs;
};

const solve = (N, M, A) => {
  const target = findIndex(N, M, A, "L");

  const q = [target];
  const ans = Array.from(A, (row) => [...row]);

  while (q.length > 0) {
    const [r, c] = q.pop();
    for (const [nr, nc] of getNeibs(N, M, ans, r, c)) {
      const nbs = getNeibs(N, M, ans, nr, nc);
      if (nbs.length <= 1) {
        ans[nr][nc] = "+";
        q.push([nr, nc]);
      }
    }
  }

  return ans.map((row) => row.join("")).join("\n");
};

const main = () => {
  //   console.log(readline());
  const T = parseInt(readline());
  const ans = [];
  for (let t = 0; t < T; t += 1) {
    const [N, M] = readline()
      .split(" ")
      .map((x) => parseInt(x));
    const A = [];
    for (let r = 0; r < N; r += 1) {
      A.push([...readline().trim()]);
    }
    ans.push(solve(N, M, A));
  }
  console.log(ans.join("\n"));
};

// main();

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 = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [n, m] = lines[l++].trim().split(' ').map(Number)
        const grid = lines.slice(l, l + n).map(str => str.trim().split(''))
        l += n
        output[i] = solve(n, m, grid)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, m, grid) {
    let row = 0
    let col = 0
    let found = false
    for (let i = 0; i < grid.length; i++) {
        for (let j = 0; j < grid[i].length; j++) {
            if (grid[i][j] === 'L') {
                found = true
                row = i
                col = j
                break
            }
        }
        if (found) break
    }
// console.log(grid, row, col)

    const visited = {}
    const connected = {}
    connected[key(row, col)] = 1
    const q = [[row, col, -1, -1]]
    const ans = []
    while (q.length) {
        const [i, j, pi, pj] = q.shift()
        const k = key(i, j)
        // if (visited[k]) continue
        // visited[k] = 1

        const tq = []
        check(n, m, grid, visited, tq, i + 1, j, pi, pj)
        check(n, m, grid, visited, tq, i - 1, j, pi, pj)
        check(n, m, grid, visited, tq, i, j + 1, pi, pj)
        check(n, m, grid, visited, tq, i, j - 1, pi, pj)
// console.log(i, j, tq.length)
        if (tq.length <= 1 || grid[i][j] === 'L') {
            // connected[k] = 1
            // ans.push([i, j])
            // if (grid[i][j] === '.') {
                grid[i][j] = '+'
            // }
        tq.forEach(([ci, cj]) => {
            // if (!visited[key(ci, cj)]) {
                q.push([ci, cj, i, j])
            // }
        })
        }
    }

    grid[row][col] = 'L'
    // ans.forEach(([i, j]) => {
    //     grid[i][j] = '+'
    // })
    return grid.map(r => r.join('')).join('\n')
}
function check(n, m, grid, visited, tq, i, j, pi, pj) {
    // if (i === pi && j === pj) return false
    if (i < 0 || i >= n || j < 0 || j >= m
        || grid[i][j] !== '.') return false
        // || '#+'.indexOf(grid[i][j]) >= 0) return false
    tq.push([i, j])

    return true
}
function key(i, j) {
    return i + ',' + j
}

const fs = require("fs");
process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

fs.readFile("input.txt", "utf8", (err, data) => {
  if (err) {
    console.error(err);
    return;
  }
  inputString = data
    .trim()
    .split("\n")
    .map((string) => {
      return string.trim();
    });

  main();
});

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

const findIndex = (N, M, A, target) => {
  for (let r = 0; r < N; r += 1) {
    for (let c = 0; c < M; c += 1) {
      if (A[r][c] == target) {
        return [r, c];
      }
    }
  }

  return [-1, -1];
};

const getNeibs = (N, M, A, R, C) => {
  const neibs = [];
  for (const [nr, nc] of [
    [R + 1, C],
    [R - 1, C],
    [R, C + 1],
    [R, C - 1],
  ]) {
    if (0 <= nr && nr < N && 0 <= nc && nc < M && A[nr][nc] == ".") {
      neibs.push([nr, nc]);
    }
  }

  return neibs;
};

const solve = (N, M, A) => {
  const target = findIndex(N, M, A, "L");

  const q = [target];
  const ans = Array.from(A, (row) => [...row]);

  while (q.length > 0) {
    const [r, c] = q.pop();
    for (const [nr, nc] of getNeibs(N, M, ans, r, c)) {
      const nbs = getNeibs(N, M, ans, nr, nc);
      if (nbs.length <= 1) {
        ans[nr][nc] = "+";
        q.push([nr, nc]);
      }
    }
  }

  return ans.map((row) => row.join("")).join("\n");
};

const main = () => {
  //   console.log(readline());
  const T = parseInt(readline());
  const ans = [];
  for (let t = 0; t < T; t += 1) {
    const [N, M] = readline()
      .split(" ")
      .map((x) => parseInt(x));
    const A = [];
    for (let r = 0; r < N; r += 1) {
      A.push([...readline().trim()]);
    }
    ans.push(solve(N, M, A));
  }
  console.log(ans.join("\n"));
};

// main();

"use strict";

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

let inputString = "";
let currentLine = 0;

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

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

  console.log("on end", inputString);

  main();
});

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

const findIndex = (N, M, A, target) => {
  for (let r = 0; r < N; r += 1) {
    for (let c = 0; c < M; c += 1) {
      if (A[r][c] == target) {
        return [r, c];
      }
    }
  }

  return [-1, -1];
};

const getNeibs = (N, M, A, R, C) => {
  const neibs = [];
  for (const [nr, nc] of [
    [R + 1, C],
    [R - 1, C],
    [R, C + 1],
    [R, C - 1],
  ]) {
    if (0 <= nr && nr < N && 0 <= nc && nc < M && A[nr][nc] == ".") {
      neibs.push([nr, nc]);
    }
  }

  return neibs;
};

const solve = (N, M, A) => {
  const target = findIndex(N, M, A, "L");

  const q = [target];
  const ans = Array.from(A, (row) => [...row]);

  while (q.length > 0) {
    const [r, c] = q.pop();
    for (const [nr, nc] of getNeibs(N, M, ans, r, c)) {
      const nbs = getNeibs(N, M, ans, nr, nc);
      if (nbs.length <= 1) {
        ans[nr][nc] = "+";
        q.push([nr, nc]);
      }
    }
  }

  return ans.map((row) => row.join("")).join("\n");
};

const main = () => {
  //   console.log(readline());
  const T = parseInt(readline());
  const ans = [];
  for (let t = 0; t < T; t += 1) {
    const [N, M] = readline()
      .split(" ")
      .map((x) => parseInt(x));
    const A = [];
    for (let r = 0; r < N; r += 1) {
      A.push([...readline().trim()]);
    }
    ans.push(solve(N, M, A));
  }
  console.log(ans.join("\n"));
};

// main();

// import * as readline from 'node:readline/promises';

const findIndex = (N, M, A, target) => {
    for (let r = 0; r < N; r += 1) {
        for (let c = 0; c < M; c += 1) {
            if (A[r][c] == target) {
                return [r, c];
            }
        }
    }

    return [-1, -1];
}

const getNeibs = (N, M, A, R, C) => {
    const neibs = [];
    for (const [nr, nc] of [[R+1, C], [R-1, C], [R, C+1], [R, C-1]]) {
        if (0 <= nr && nr < N && 0 <= nc && nc < M && A[nr][nc] == '.') {
            neibs.push([nr, nc]);
        }
    }

    return neibs;
}

const solve = (N, M, A) => {
    const target = findIndex(N, M, A, 'L');

    const q = [target];
    const ans = Array.from(A, row => [...row]);

    while (q.length > 0) {
        const [r, c] = q.pop();
        for (const [nr, nc] of getNeibs(N, M, ans, r, c)) {
            const nbs = getNeibs(N, M, ans, nr, nc);
            if (nbs.length <= 1) {
                ans[nr][nc] = '+';
                q.push([nr, nc]);
            }

        }
    }

    return ans.map(row => row.join('')).join('\n')
};

const main = () => {
  const T = parseInt(readline());
  const ans = [];
  for (let t = 0; t < T; t += 1) {
    const [N, M] = readline()
      .split(" ")
      .map((x) => parseInt(x));
    const A = [];
    for (let r = 0; r < N; r += 1) {
      A.push([...readline().trim()]);
    }
    ans.append(solve(N, M, A));
  }
  print(ans.join("\n"));
};

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 = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [n, m] = lines[l++].trim().split(' ').map(Number)
        const grid = lines.slice(l, l + n).map(str => str.trim().split(''))
        l += n
        output[i] = solve(n, m, grid)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, m, grid) {
    let row = 0
    let col = 0
    let found = false
    for (let i = 0; i < grid.length; i++) {
        for (let j = 0; j < grid[i].length; j++) {
            if (grid[i][j] === 'L') {
                found = true
                row = i
                col = j
                break
            }
        }
        if (found) break
    }
// console.log(grid, row, col)

    const visited = {}
    const connected = {}
    connected[key(row, col)] = 1
    const q = [[row, col, -1, -1]]
    const ans = []
    while (q.length) {
        const [i, j, pi, pj] = q.shift()
        const k = key(i, j)
        if (visited[k]) continue
        visited[k] = 1

        const tq = []
        check(n, m, grid, visited, tq, i + 1, j, pi, pj)
        check(n, m, grid, visited, tq, i - 1, j, pi, pj)
        check(n, m, grid, visited, tq, i, j + 1, pi, pj)
        check(n, m, grid, visited, tq, i, j - 1, pi, pj)

        if (tq.length <= 1) {
            // connected[k] = 1
            // ans.push([i, j])
            if (grid[i][j] === '.') {
                grid[i][j] = '+'
            }
        }
        tq.forEach(([ci, cj]) => {
            if (!visited[key(ci, cj)]) {
                q.push([ci, cj, i, j])
            }
        })
    }

    // ans.forEach(([i, j]) => {
    //     grid[i][j] = '+'
    // })
    return grid.map(r => r.join('')).join('\n')
}
function check(n, m, grid, visited, tq, i, j, pi, pj) {
    // if (i === pi && j === pj) return false
    if (i < 0 || i >= n || j < 0 || j >= m || grid[i][j] !== '.') return false
    tq.push([i, j])

    return true
}
function key(i, j) {
    return i + ',' + j
}

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 = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [n, m] = lines[l++].trim().split(' ').map(Number)
        const grid = lines.slice(l, l + n).map(str => str.trim().split(''))
        l += n
        output[i] = solve(n, m, grid)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, m, grid) {
    let row = 0
    let col = 0
    let found = false
    for (let i = 0; i < grid.length; i++) {
        for (let j = 0; j < grid[i].length; j++) {
            if (grid[i][j] === 'L') {
                found = true
                row = i
                col = j
                break
            }
        }
        if (found) break
    }
// console.log(grid, row, col)

    const visited = {}
    const connected = {}
    connected[key(row, col)] = 1
    const q = [[row, col, -1, -1]]
    const ans = []
    while (q.length) {
        const [i, j, pi, pj] = q.shift()
        const k = key(i, j)
        if (visited[k]) continue
        visited[k] = 1

        const tq = []
        check(n, m, grid, visited, tq, i + 1, j, pi, pj)
        check(n, m, grid, visited, tq, i - 1, j, pi, pj)
        check(n, m, grid, visited, tq, i, j + 1, pi, pj)
        check(n, m, grid, visited, tq, i, j - 1, pi, pj)

        if (connected[key(pi, pj)] && tq.length <= 1) {
            connected[k] = 1
            ans.push([i, j])
        }
        tq.forEach(([ci, cj]) => {
            if (!visited[key(ci, cj)]) {
                q.push([ci, cj, i, j])
            }
        })
    }

    ans.forEach(([i, j]) => {
        grid[i][j] = '+'
    })
    return grid.map(r => r.join('')).join('\n')
}
function check(n, m, grid, visited, tq, i, j, pi, pj) {
    if (i === pi && j === pj) return false
    if (i < 0 || i >= n || j < 0 || j >= m || grid[i][j] === '#') return false
    tq.push([i, j])

    return true
}
function key(i, j) {
    return i + ',' + j
}


  var tmp = readline().split(' ').map(function(x) { return parseInt(x)});
  var n = tmp[0];
  var k = tmp[1];
  var d = readline().split(' ').map(function(x) { return x === 'YES'; });
  var names = [];
  for(var i = 0; i < k; i += 1) {
    names[i] = (i + 1).toString().split('').map(function(x) { return parseInt(x); }).map(function(x) { return String.fromCharCode(65 + x); }).join('').toLowerCase();
  }
  names = names.map(function(string) {
    return string.charAt(0).toUpperCase() + string.slice(1);
  });
  var res = [];
  var it = 0;
  for(var i = 0; i < k - 1; i += 1) {
    res.push(names[it]);
    it += 1;
    it %= k;
  }
  for(var i = k - 1; i < n; i += 1) {
    if(d[i - k + 1]) {
      res.push(names[it]);
      it += 1;
      it %= k;
    } else {
      var tmp = names[it];
      names[it] = names[(it + 1) % k];
      names[(it + 1) % k] = tmp;
      res.push(names[it]);
      it += 1;
      it %= k;
    }
  }
  print(res.join(' '));

// Polyfill for NodeJS
if (undefined == readline) {
	var rLines = require('fs').readFileSync("/dev/stdin", "utf8").split("\n"),
		rIndex = 0,
		readline = function() {
			rIndex ++
			return rLines[rIndex - 1]
		}
}
if (undefined == print) {
	var print = console.log
}

// Useful Read functions
var int = function() {
	return parseInt(readline())
}

var ints = function() {
	return readline().split(' ')
		.map(function(x) {
			return parseInt(x)
		})
}

// The answer
var names = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'Aa','Ba','Ca','Da','Ea','Fa','Ga','Ha','Ia','Ja','Ka','La','Ma','Na','Oa','Pa','Qa','Ra','Sa','Ta','Ua','Va','Wa','Xa','Ya','Za',
'Ab','Bb','Cb','Db','Eb','Fb','Gb','Hb','Ib','Jb','Kb','Lb','Mb','Nb','Ob','Pb','Qb','Rb','Sb','Tb','Ub','Vb','Wb','Xb','Yb','Zb']

var ns = ints(),
	n = ns[0],
	k = ns[1],
	i = 0,
	j = 0,
	count = 1,
	words = [],
	notes = readline().split(' ').map(function(w) {
		return w == 'YES'
	})

for(i = 0; i < k - 1; i ++)
	words[i] = i

count = i
while (i < n) {
	if (notes[j]) {
		words[i] = count
		count ++
	} else {
		words[i] = words[i - k + 1]
	}
	i ++
	j ++
}

print(words.map(function(n) { return names[n] }).join(' '))

var input = readline().split(' ').map(Number);

var n = input[0]; //number of soldiers
var k = input[1]; //size of each group

var notes = readline().split(' ').map(String);

// Let's create 52 unique soldier names
var names = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Aa', 'Ba', 'Ca', 'Da', 'Ea', 'Fa', 'Ga', 'Ha', 'Ia', 'Ja', 'Ka', 'La', 'Ma', 'Na', 'Oa', 'Pa', 'Qa', 'Ra', 'Sa', 'Ta', 'Ua', 'Va', 'Wa', 'Xa', 'Ya', 'Za'];

var soldiers = [];
var s_count = 0;
var n_count = 0;
var l = 0;

//Ititial Group
if (notes[0] == 'YES') {
	for (var j = 0; j < k; j++) {
		soldiers[s_count] = names[n_count];
		s_count ++;
		n_count ++;
	}
} else if (notes[0] == 'NO') {
	soldiers[s_count + k - 1] = names[n_count];
	while (l < k - 1) {
		soldiers[s_count] = names[n_count];
		s_count ++;
		n_count ++;
		l ++;
	}
	s_count ++;
}

//then attach either the first name of the group or the next name in the name list to the end for each group.

for (var i = 1; i < n - k + 1; i++) {
	if (notes[i] == 'YES') {
		soldiers[s_count] = names[n_count];
		s_count ++;
		n_count ++;
	} else if (notes[i] == 'NO') {
		soldiers[s_count] = soldiers[s_count - k + 1];
		s_count ++;
	}
}

var output = soldiers.join(" ");

print(output);

var a = readline().trim().split(" ");
var n = +a[0], k = +a[1];
var effective = readline().trim().split(" ").map((val) => {
    return (val == "NO" ? false : true);
});
var big_letters = "QWERTYUIOPASDFGHJKLZXCVBNM";
var small_letters = "qwertyuiopasdfghjklzxcvbnm";

var names_i = 0;
var names = [];
for(var i = 0; i < 3; i++){
    var myname = big_letters[i];
    for(var j = 0; j < 26; j++){
        names[names_i++] = myname + small_letters[j];
    }
}

var soldier_names = [];
var name_link = 0;
var solider_has_name = [];

for(var i = 0; i < n; i++){
    solider_has_name[i] = false;
}

for(var i = 0; i < n - k + 1; i++){
    if(effective[i] === true){
        for(var j = 0; j < k; j++){
            var ij = i + j;
            if(!solider_has_name[ij]){
                soldier_names[ij] = names[name_link++];
                solider_has_name[ij] = true;
            }
        }
    }else{
        if(solider_has_name[i] === true){
            for(var j = 1; j < k; j++){
                var ij = i + j;
                if(solider_has_name[ij] === false){
                    soldier_names[ij] = soldier_names[i];
                    solider_has_name[ij] = true;
                    break;
                }
            }
        }else{
            var name_of_two_soldiers = names[name_link++];
            for(var j = 0; j < 2; j++){
                var ij = i + j;
                soldier_names[ij] = name_of_two_soldiers;
                solider_has_name[ij] = true;
            }
        }
    }
}

for(var i = 0; i < n; i++){
    if(solider_has_name[i] === false){
        soldier_names[i] = names[name_link++];
    }
}

print(soldier_names.join(" "));

// Polyfill for NodeJS
if (undefined == readline) {
	var rLines = require('fs').readFileSync("/dev/stdin", "utf8").split("\n"),
		rIndex = 0,
		readline = function() {
			rIndex ++
			return rLines[rIndex - 1]
		}
}
if (undefined == print) {
	var print = console.log
}

// Useful Read functions
var int = function() {
	return parseInt(readline())
}

var ints = function() {
	return readline().split(' ')
		.map(function(x) {
			return parseInt(x)
		})
}

// The answer
var names = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'Aa','Ba','Ca','Da','Ea','Fa','Ga','Ha','Ia','Ja','Ka','La','Ma','Na','Oa','Pa','Qa','Ra','Sa','Ta','Ua','Va','Wa','Xa','Ya','Za',
'Ab','Bb','Cb','Db','Eb','Fb','Gb','Hb','Ib','Jb','Kb','Lb','Mb','Nb','Ob','Pb','Qb','Rb','Sb','Tb','Ub','Vb','Wb','Xb','Yb','Zb']

var ns = ints(),
	n = ns[0],
	k = ns[1],
	i = 0,
	count = 1,
	words = [],
	notes = readline().split(' ').map(function(w) {
		return w == 'YES'
	})

for(i = 0; i < k - 1; i ++)
	words[i] = i

count = k
i = 0
while (i < notes.length) {
	if (notes[i]) {
		words[k - 1 + i] = count
		count ++
	} else {
		words[k - 1 + i] = i
	}
	i ++
}

print(words.map(function(n) { return names[n] }).join(' '))

var input = readline().split(' ').map(Number);

var n = input[0]; //number of soldiers
var k = input[1]; //size of each group

var notes = readline().split(' ').map(String);

// Let's create 52 unique soldier names
var names = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Aa', 'Ba', 'Ca', 'Da', 'Ea', 'Fa', 'Ga', 'Ha', 'Ia', 'Ja', 'Ka', 'La', 'Ma', 'Na', 'Oa', 'Pa', 'Qa', 'Ra', 'Sa', 'Ta', 'Ua', 'Va', 'Wa', 'Xa', 'Ya', 'Za'];

var soldiers = [];
var s_count = 0;
var n_count = 0;
var l = 0;

//Ititial Group
if (notes[0] == 'YES') {
	for (var j = 0; j < k; j++) {
		soldiers[s_count] = names[n_count];
		s_count ++;
		n_count ++;
	}
} else if (notes[0] == 'NO') {
	while (l < k - 1) {
		soldiers[s_count] = names[n_count];
		soldiers[s_count + k - 1] = names[n_count];
		s_count ++;
		n_count ++;
		l ++;
	}
	s_count ++;
}

//then attach either the first name of the group or the next name in the name list to the end for each group.

for (var i = 1; i < n - k + 1; i++) {
	if (notes[i] == 'YES') {
		soldiers[s_count] = names[n_count];
		s_count ++;
		n_count ++;
	} else if (notes[i] == 'NO') {
		soldiers[s_count] = soldiers[s_count - k + 1];
		s_count ++;
	}
}

var output = soldiers.join(" ");

print(output);


'use strict'

const getLine = () => readline().split(' ')
const getInts = () => getLine().map(n => parseInt(n))
const getInt = () => getInts()[0]
const D = (...args) => { // D({name})
  [...args].forEach(cur => print.apply(print, [JSON.stringify(cur)]))
}

main()

function main() {
  const input = getInts()
  const arr = getInts()
  const ans = solve(...input, arr)
  print(ans)
}

function solve (n, h, l, r, arr) {
  const MX = n + 2
  const inf = MX
  const dp = []
  for (let i = 0; i < MX; ++i) {
    dp[i] = []
    for (let j = 0; j < MX; ++j) {
      dp[i].push(-inf)
    }
  }

  dp[0][0] = 0
  const isGood = good(h, l, r)
  let sum = 0

  for (let i = 0; i < n; ++i) {
    sum += arr[i]
    for (let j = 0; j <= n; ++j) {
      const a = isGood(sum - j)
      const b = isGood(sum - j - 1)
      dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][j] + a)
      dp[i + 1][j + 1] = Math.max(dp[i + 1][j + 1], dp[i][j] + b)
    }
  }

  return dp[n].reduce((ans, cur) => Math.max(ans, cur), -1)
}

function good (h, l, r, val) {
  return function (val) {
    val %= h
    return val >= l && val <= r
  }
}

var findMaxGoodSleeps = function(ts, h, l, r) {
  //hour will be manipulated with each table insertion
  //represents the hour of day that X is being woken up at
  //could be good or bad, attempting to maximize good days
  var hour = 0;
  //ts is the individual wait times while totalWaits is the sum up to each index
  var totalWaits = [];
  //table is where values for good waking times will be stored
  //the end of each row will include each potential maximum value
  var table = new Array(ts.length + 1);
  for (var i = 0; i < table.length; i++) {
    table[i] = [];
  }

  //creating array with the sums of the wait times up to current index
  totalWaits[0] = ts[0];
  for (var i = 1; i < ts.length; i++) {
    totalWaits[i] = totalWaits[i - 1] + ts[i];
  }
  //creating table for finding max value, setting first row which will include
  //the unaltered values and their corresponding maximum sums
  table[0][0] = 0;
  for (var i = 1; i <= ts.length; i++) {
    table[0][i] = table[0][i - 1];
    hour = totalWaits[i - 1] % h;
    if (hour >= l && hour <= r) {
      table[0][i]++;
    }
  }

  //setting the rest of the tables values
  for (var j = 1; j <= ts.length; j++) {
    table[j][j - 1] = 0;
    for (var i = j; i <= ts.length; i++) {
      table[j][i] = Math.max(table[j - 1][i - 1], table[j][i - 1]);
      hour = (totalWaits[i - 1] - j) % h;
      if (hour >= l && hour <= r) {
        table[j][i]++;
      }
    }
  }

  //finding max value by looking at end of rows
  var max = 0;
  for (var i = 0; i <= ts.length; i++) {
    if (table[i][ts.length] > max)
      max = table[i][ts.length];
  }
  return max;
}

var firstLine = readline();
var secondLine = readline();
var nums = secondLine.split(' ').map((x) => (parseInt(x)));
var info = firstLine.split(' ');
print(findMaxGoodSleeps(nums, parseInt(info[1]), parseInt(info[2]), parseInt(info[3])));

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() {
  const [n, h, l, r] = readInts()
  const a = readInts()
  let dp = new Array(n + 1)
  for(let i = 0; i <= n; i++) dp[i] = new Array(n + 1).fill(-Infinity)

  dp[0][0] = 0
  let sum = 0
  for(let i = 0; i < n; i++) {
    sum += a[i]
    for(let j = 0; j <= i; j++) {
      dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][j] + inR((sum - j) % h))
      dp[i + 1][j + 1] = Math.max(dp[i + 1][j + 1], dp[i][j] + inR((sum - j - 1) % h))
    }
  }

  wr(Math.max(...dp[n]))

  function inR(x) {
    return x >= l && x <= r ? 1 : 0
  }
}