'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    // const nk = parseInt(readLine(), 10);
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ').map(Number);
    const n = nk[0];
    const k = nk[1];
    // console.log(n, k, arr)

    const result = countSegment2(n, k, arr);
    printResult(result);
}

const countSegment = (n, k, ar) => {
    // const counts = new Array(100010).fill(0);
    const counts = [];
    for (let i = 0; i <= 100010; i++) {
        counts.push(0);
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            counts[ar[i]] = i;
            if (ar[i] === ar[start]) {
                while (counts[start] !== start) {
                    start++;
                }
            }
            continue;
        }
        counts[ar[i]] = i;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
}

const countSegment2 = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    let f;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            end = i;
            f = 1;
            break;
        }
    }

    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    sum = 0;
    for (let i = end; i >= 1; i--) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            start = i;
            break;
        }
    }
    return f ? `${start} ${end}` : `-1 -1`;
}

function printResult(x) {
    process.stdout.write(x);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    // const nk = parseInt(readLine(), 10);
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ').map(Number);
    const n = nk[0];
    const k = nk[1];
    // console.log(n, k, arr)

    const result = countSegment(n, k, arr);
    printResult(result);
}

const countSegment = (n, k, ar) => {
    const counts = new Array();
    // const counts = new Array(100010);
    // for (let i = 0; i <= 100010; i++) {
    //     counts[i] = 0;
    // }
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            counts[ar[i]] = i;
            if (ar[i] === ar[start]) {
                while (counts[ar[start]] !== start) {
                    start++;
                }
            }
            continue;
        }
        counts[ar[i]] = i;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
};

const countSegment2 = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    let f;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            end = i;
            f = 1;
            break;
        }
    }

    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    sum = 0;
    for (let i = end; i >= 1; i--) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            start = i;
            break;
        }
    }
    return f ? `${start} ${end}` : `-1 -1`;
};

function printResult(x) {
    process.stdout.write(x);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    // const nk = parseInt(readLine(), 10);
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ').map(Number);
    const n = nk[0];
    const k = nk[1];
    // console.log(n, k, arr)

    const result = countSegment(n, k, arr);
    printResult(result);
}

const countSegment = (n, k, ar) => {
    const counts = new Array(100001);
    // for (let i = 0; i <= 100010; i++) {
    //     counts[i] = 0;
    // }
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            counts[ar[i]] = i;
            if (ar[i] === ar[start]) {
                while (counts[ar[start]] !== start) {
                    start++;
                }
            }
            continue;
        }
        counts[ar[i]] = i;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
};

const countSegment2 = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    let f;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            end = i;
            f = 1;
            break;
        }
    }

    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    sum = 0;
    for (let i = end; i >= 1; i--) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            start = i;
            break;
        }
    }
    return f ? `${start} ${end}` : `-1 -1`;
};

function printResult(x) {
    process.stdout.write(x);
}

function giaiBai(inp1, inp2) {
    inp1 = inp1.split(' ').map(e => parseInt(e))
    inp2 = inp2.split(' ').map(e => parseInt(e))
    inp2.unshift(0)

    let n = inp1[0],
        k = inp1[1],
        a = inp2,
        c = new Array(10e5).fill(0),
        count = 0,
        j = 0

    for(var i = 1; i <= n; i++) {
        c[a[i]]++
        if (c[a[i]] === 1) {
            count++
        }
        while (count === k) {
            j++
            c[a[j]]--
            if(c[a[j]] === 0) {
                console.log(j, i)
                break
            }
        }
        if(count === k) {
            break
        }
    }
    if (count === k) {
        return
    }
    console.log('-1 -1')
}

var readline = require('readline');
// Get process.stdin as the standard input object.
var standard_input = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

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

// Prompt user to input data in console.
// console.log("Please input text in command line.");

// When user input data and click enter key.
standard_input.on('line', function (inp1) {
//     console.log(inp1);
    standard_input.on('line', function (inp2) {
        // Print user input in console.
        inp1 = inp1.trim()
        inp2 = inp2.trim()
        giaiBai(inp1, inp2)
        process.exit();
    });
});

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const input = readline().split(' ').map(Number)
  const [length, distinct] = input
  const nums = readline().split(' ').map(Number)
  helper(nums, length, distinct)
}

function helper(nums, length, distinct) {
  let cnt = new Map()
  let unique = 0
  let j = 0

  for (let i = 0; i < length; i++) {
    const num = nums[i]
    if (!cnt.has(num))
      unique++
    cnt.set(num, (cnt.get(num) || 0) + 1)
    while (unique === distinct) {
      cnt.set(nums[j], cnt.get(nums[j])-1);
      if (cnt.get(nums[j]) === 0) {
        console.log((j + 1) + ' ' + (i + 1))
        return
      }
      j++
    }
  }

  console.log('-1 -1')
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ').map(Number);
    const n = nk[0];
    const k = nk[1];

    const result = countSegment(n, k, arr);
    printResult(result);
}

const countSegment = (n, k, ar) => {
    const counts = new Array(100010);
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            counts[ar[i]] = i;
            if (ar[i] === ar[start]) {
                while (counts[ar[start]] !== start) {
                    start++;
                }
            }
            continue;
        }
        counts[ar[i]] = i;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
};

function printResult(x) {
    process.stdout.write(x);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    // const nk = parseInt(readLine(), 10);
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ').map(Number);
    const n = nk[0];
    const k = nk[1];
    // console.log(n, k, arr)

    const result = countSegment(n, k, arr);
    printResult(result);
}

const countSegment = (n, k, ar) => {
    const counts = new Array(100010).fill(0);
    // for (let i = 0; i <= 100010; i++) {
    //     counts[i] = 0;
    // }
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            counts[ar[i]] = i;
            if (ar[i] === ar[start]) {
                while (counts[ar[start]] !== start) {
                    start++;
                }
            }
            continue;
        }
        counts[ar[i]] = i;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
};

const countSegment2 = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    let f;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            end = i;
            f = 1;
            break;
        }
    }

    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    sum = 0;
    for (let i = end; i >= 1; i--) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            start = i;
            break;
        }
    }
    return f ? `${start} ${end}` : `-1 -1`;
};

function printResult(x) {
    process.stdout.write(x);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    // const nk = parseInt(readLine(), 10);
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ').map(Number);
    const n = nk[0];
    const k = nk[1];
    // console.log(n, k, arr)

    const result = countSegment(n, k, arr);
    printResult(result);
}

const countSegment = (n, k, ar) => {
    const counts = [];
    // const counts = new Array(100010);
    // for (let i = 0; i <= 100010; i++) {
    //     counts[i] = 0;
    // }
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            counts[ar[i]] = i;
            if (ar[i] === ar[start]) {
                while (counts[ar[start]] !== start) {
                    start++;
                }
            }
            continue;
        }
        counts[ar[i]] = i;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
};

const countSegment2 = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    let f;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            end = i;
            f = 1;
            break;
        }
    }

    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    sum = 0;
    for (let i = end; i >= 1; i--) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            start = i;
            break;
        }
    }
    return f ? `${start} ${end}` : `-1 -1`;
};

function printResult(x) {
    process.stdout.write(x);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    // const nk = parseInt(readLine(), 10);
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ').map(Number);
    const n = nk[0];
    const k = nk[1];
    // console.log(n, k, arr)

    const result = countSegment(n, k, arr);
    printResult(result);
}

const countSegment = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            counts[ar[i]] = i;
            if (ar[i] === ar[start]) {
                while (counts[ar[start]] !== start) {
                    start++;
                }
            }
            continue;
        }
        counts[ar[i]] = i;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
};

const countSegment2 = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    let f;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            end = i;
            f = 1;
            break;
        }
    }

    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    sum = 0;
    for (let i = end; i >= 1; i--) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            start = i;
            break;
        }
    }
    return f ? `${start} ${end}` : `-1 -1`;
};

function printResult(x) {
    process.stdout.write(x);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    // const nk = parseInt(readLine(), 10);
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ').map(Number);
    const n = nk[0];
    const k = nk[1];
    // console.log(n, k, arr)

    const result = countSegment(n, k, arr);
    printResult(result);
}

const countSegment = (n, k, ar) => {
    const counts = new Array(100010);
    // for (let i = 0; i <= 100010; i++) {
    //     counts[i] = 0;
    // }
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            counts[ar[i]] = i;
            if (ar[i] === ar[start]) {
                while (counts[ar[start]] !== start) {
                    start++;
                }
            }
            continue;
        }
        counts[ar[i]] = i;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
};

const countSegment2 = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    let f;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            end = i;
            f = 1;
            break;
        }
    }

    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    sum = 0;
    for (let i = end; i >= 1; i--) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            start = i;
            break;
        }
    }
    return f ? `${start} ${end}` : `-1 -1`;
};

function printResult(x) {
    process.stdout.write(x);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    // const nk = parseInt(readLine(), 10);
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ');
    const n = nk[0];
    const k = nk[1];
    // console.log(n, k, arr)

    const result = countSegment(n, k, arr);
    printResult(result);
}

const countSegment = (n, k, ar) => {
    const counts = new Array(100001);
    // const counts = new Array(100010);
    // for (let i = 0; i <= 100010; i++) {
    //     counts[i] = 0;
    // }
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[parseInt(ar[i], 10)]) {
            counts[parseInt(ar[i], 10)] = `${i}`;
            if (ar[i] == ar[start]) {
                while (counts[parseInt(ar[start], 10)] != start) {
                    start++;
                }
            }
            continue;
        }
        counts[parseInt(ar[i], 10)] = `${i}`;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
};

const countSegment2 = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    let f;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            end = i;
            f = 1;
            break;
        }
    }

    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    sum = 0;
    for (let i = end; i >= 1; i--) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            start = i;
            break;
        }
    }
    return f ? `${start} ${end}` : `-1 -1`;
};

function printResult(x) {
    process.stdout.write(x);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    // const nk = parseInt(readLine(), 10);
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ').map(Number);
    const n = nk[0];
    const k = nk[1];
    // console.log(n, k, arr)

    const result = countSegment(n, k, arr);
    printResult(result);
}

const countSegment = (n, k, ar) => {
    const counts = new Array(100001).fill(0);
    // const counts = new Array(100010);
    // for (let i = 0; i <= 100010; i++) {
    //     counts[i] = 0;
    // }
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            counts[ar[i]] = i;
            if (ar[i] === ar[start]) {
                while (counts[ar[start]] !== start) {
                    start++;
                }
            }
            continue;
        }
        counts[ar[i]] = i;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
};

const countSegment2 = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    let f;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            end = i;
            f = 1;
            break;
        }
    }

    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    sum = 0;
    for (let i = end; i >= 1; i--) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            start = i;
            break;
        }
    }
    return f ? `${start} ${end}` : `-1 -1`;
};

function printResult(x) {
    process.stdout.write(x);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    // const nk = parseInt(readLine(), 10);
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ').map(Number);
    const n = nk[0];
    const k = nk[1];
    // console.log(n, k, arr)

    const result = countSegment(n, k, arr);
    printResult(result);
}

const countSegment = (n, k, ar) => {
    // const counts = new Array(100010).fill(0);
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            counts[ar[i]] = i;
            if (ar[i] === ar[start]) {
                while (counts[ar[start]] !== start) {
                    start++;
                }
            }
            continue;
        }
        counts[ar[i]] = i;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
};

const countSegment2 = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    let f;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            end = i;
            f = 1;
            break;
        }
    }

    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    sum = 0;
    for (let i = end; i >= 1; i--) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            start = i;
            break;
        }
    }
    return f ? `${start} ${end}` : `-1 -1`;
};

function printResult(x) {
    process.stdout.write(x);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const input = readline().split(' ').map(Number)
  const [length, distinct] = input
  const nums = readline().split(' ').map(Number)
  helper(nums, length, distinct)
}

function helper(nums, length, distinct) {
  let cnt = new Map()
  let unique = 0
  let j = 0

  for (let i = 0; i < length; i++) {
    const num = nums[i]
    if (!cnt.has(num))
      unique++
    cnt.set(num, (cnt.get(num) || 0) + 1)
    while (unique === distinct) {
      cnt.set(num, cnt.get(num)-1);
      if (cnt.get(num) === 0) {
        console.log((j + 1) + ' ' + (i + 1))
        return
      }
      j++
    }
  }

  console.log('-1 -1')
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const input = readline().split(' ').map(Number)
  const [length, distinct] = input
  const nums = readline().split(' ').map(Number)
  helper(nums, length, distinct)
}

function helper(nums, length, distinct) {
  let cnt = new Map()
  let unique = 0
  let j = 0

  for (let i = 0; i < length; i++) {
    const num = nums[i]
    if (!cnt.has(num))
      unique++
    cnt.set(num, (cnt.get(num) || 0) + 1)
    while (unique === distinct) {
      cnt.set(num, cnt.get(num)-1);
      if (cnt.get(num) === 0) {
        console.log(i + ' ' + j)
        return
      }
      j++
    }
  }

  console.log('-1 -1')
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    // const nk = parseInt(readLine(), 10);
    const nk = readLine().split(' ').map(Number);
    const arr = `0 ${readLine()}`.split(' ').map(Number);
    const n = nk[0];
    const k = nk[1];
    // console.log(n, k, arr)

    const result = countSegment(n, k, arr);
    // printResult(result);
}

const countSegment = (n, k, ar) => {
    // const counts = new Array(100010).fill(0);
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            counts[ar[i]] = i;
            if (ar[i] === ar[start]) {
                while (counts[ar[start]] !== start) {
                    start++;
                }
            }
            continue;
        }
        counts[ar[i]] = i;
        sum++;
        if (sum === k) {
            end = i;
            break;
        }
    }

    return end ? `${start} ${end}` : `-1 -1`;
};

const countSegment2 = (n, k, ar) => {
    const counts = new Array(100010);
    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    let start = 1;
    let end = 0;
    let sum = 0;
    let f;
    for (let i = 1; i <= n; i++) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            end = i;
            f = 1;
            break;
        }
    }

    for (let i = 0; i <= 100010; i++) {
        counts[i] = 0;
    }
    sum = 0;
    for (let i = end; i >= 1; i--) {
        if (counts[ar[i]]) {
            continue;
        }
        counts[ar[i]] = 1;
        sum++;
        if (sum === k) {
            start = i;
            break;
        }
    }
    return f ? `${start} ${end}` : `-1 -1`;
};

function printResult(x) {
    process.stdout.write(x);
}

function giaiBai(inp1, inp2) {
    inp1 = inp1.split(' ').map(e => parseInt(e))
    inp2 = inp2.split(' ').map(e => parseInt(e))
    inp2.unshift(0)

    let n = inp1[0],
        k = inp1[1],
        a = inp2,
        c = new Array(10e5).fill(0),
        count = 0,
        j = 0

    for(var i = 1; i <= n; i++) {
        c[a[i]]++
        if (c[a[i]] === 1) {
            count++
        }
        while (count === k) {
            j++
            c[a[j]]--
            if(c[a[j]] === 0) {
                console.log(j, i)
                break
            }
        }
        if(count === k) {
            break
        }
    }
    if (count === k) {
        return
    }
    console.log('-1 -1')
}

// var readline = require('readline');
// Get process.stdin as the standard input object.
// var standard_input = readline.createInterface({
//   input: process.stdin,
//   output: process.stdout,
//   terminal: false
// });
var standard_input = process.stdin;
// Set input character encoding.
// standard_input.setEncoding('utf-8');

// Prompt user to input data in console.
// console.log("Please input text in command line.");

// When user input data and click enter key.
standard_input.on('line', function (inp1) {
//     console.log(inp1);
    standard_input.on('line', function (inp2) {
        // Print user input in console.
        inp1 = inp1.trim()
        inp2 = inp2.trim()
        giaiBai(inp1, inp2)
        process.exit();
    });
});

function giaiBai(inp1, inp2) {
    inp1 = inp1.split(' ').map(e => parseInt(e))
    inp2 = inp2.split(' ').map(e => parseInt(e))
    inp2.unshift(0)

    let n = inp1[0],
        k = inp1[1],
        a = inp2,
        c = new Array(10e5).fill(0),
        count = 0,
        j = 0

    for(var i = 1; i <= n; i++) {
        c[a[i]]++
        if (c[a[i]] === 1) {
            count++
        }
        while (count === k) {
            j++
            c[a[j]]--
            if(c[a[j]] === 0) {
                console.log(j, i)
                break
            }
        }
        if(count === k) {
            break
        }
    }
    if (count === k) {
        return
    }
    console.log('-1 -1')
}

var readline = require('readline');
// Get process.stdin as the standard input object.
var standard_input = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
});
// Set input character encoding.
// standard_input.setEncoding('utf-8');

// Prompt user to input data in console.
// console.log("Please input text in command line.");

// When user input data and click enter key.
standard_input.on('data1', function (inp1) {
    standard_input.on('data2', function (inp2) {
        // Print user input in console.
        inp1 = inp1.trim()
        inp2 = inp2.trim()
        giaiBai(inp1, inp2)
        process.exit();
    });
});


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

    while (n > 1 && n < Number.MAX_SAFE_INTEGER) {
      if (n % 6 === 0) {
        while (n % 6 === 0) {
          n /= 6;
          count++;
        }
      } else {
        n *= 2;
        count++;
      }
    }
    if (n === 1) console.log(count);
    else console.log(-1);
  }
}

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

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

  let n = BigInt(d);

  if (n === 1n) {
    ans += '0\n';
  }
  else {
    let test = 0;
    for (let i = 0; i < 50; i++) {
      if (n % 6n === 0n) {
        n = n / 6n;
      }
      else {
        n = n * 2n;
      }

      if (n === 1n) {
        test = i + 1;
        break;
      }
    }

    if (test) {
      ans += `${test}\n`;
    }
    else {
      ans += `-1\n`;
    }
  }

  c++;
});

rl.on('close', () => {
  console.log(ans);
});

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    function solve(x, moves) {
        if (x === 1) { return moves; }
        else if (x%2 === 1) { return solve(2*x, moves+1); }
        else if (x%6 === 0) { return solve(Math.floor(x/6), moves+1); }
        else { return -1; }
    }
    const testCases = parseInt(readline());
    for (var i=0; i<testCases; i++) {
        const x = parseInt(readline());
        console.log(solve(x, 0));
    }
}

const readline = require('readline');

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

var lineCount = 0
var testCount = 0
var outputStr = ''

rl.on('line', (input) => {
    if (lineCount == 0) {
        // first line
        testCount = parseInt(input)
    }
    else if (lineCount >= testCount) {
        outputStr += compute(input) + '\n'
        console.log(outputStr)
        rl.close()
    }
    else {
        // data
        outputStr += compute(input) + '\n'
    }
    lineCount++
});

function compute(str) {
    var n = parseInt(str)
    var temp = n
    var timesOfTwo = 0
    var timesOfThree = 0
    while(temp%2==0){
        temp = temp / 2
        timesOfTwo+=1
    }
    while(temp%3==0){
        temp = temp / 3
        timesOfThree+=1
    }
    // console.log(timesOfTwo, timesOfThree)
    if(temp==1&&timesOfTwo<=timesOfThree){
        return timesOfThree*2 - timesOfTwo
    }
    else return -1
}

var n = readline();
var map = [];
for (var i = 0; i<n;i++){
    var tmp = readline();
    var tmp2 = tmp;
    var iter = 0;
    while (true){
        if (tmp2 == 1){
            map.push(iter);
            break;
        }
        if (tmp2 % 2 === 0 && tmp2 % 6 !== 0){
            map.push(-1);
            break;
        }
        if (tmp2%6 === 0){
            tmp2 /= 6;
        }else{
            tmp2 *= 2;
        }
        iter++;

    }
}
for (var i = 0; i<n;i++) {
    write(map[i]+"\n");
}

var testCase = Number(readline());
while(testCase--)
{
	var number = Number(readline());
	var loopAssumed = 200;
	var answer = 0;
	var flag = 0;
	while(loopAssumed--)
	{
		if(number==1)
		{
			print(answer);
			flag=1;
			break;
		}
		if(number%6 == 0)
		{
			number = number/6;
		}
		else
		{
			number = number*2;
		}
		if(number>1e18)
		{
			break;
		}
		answer++;
	}
	if(flag==0)
	{
		print(-1);
	}
}

function solve() {
   var n = Number(read());
   var c2 = 0;
   var c3 = 0;
   while (n % 2 === 0) {
      n /= 2;
      c2++;
   }
   while (n % 3 === 0) {
      n /= 3;
      c3++;
   }
   if (n !== 1) {
      write(-1);
      return;
   }
   if (c2 > c3) {
      write(-1);
   } else {
      write(c3 * 2 - c2);
   }
}

function init() {
   var T;
   T = 1;
   T = Number(read());
   for (var t = 0; t < T; t++) {
      solve();
   }
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
      });
   } else {
      var RL = require('readline').createInterface({
         input : process.stdin,
         output : process.stdout
      });

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

      RL.on('close', init);
   }
} else {
   init();
}

function write(value) {
   isNode ? console.log(value) : print(value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}

//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = new Date();
  Main();
  var end = new Date() - start;

  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var t = nextInt();
	var output = new Array(t);
	for(var i = 0; i < t; i++){
		var n = nextInt();
		if(n == 1){
			output[i] = 0;
			continue;
		}
		var two = 0;
		var three = 0;
		while(n % 3 == 0){
			n /= 3;
			three++;
		}
		while(n % 2 == 0){
			n /= 2;
			two++;
		}
		if(n != 1){
			output[i] = -1;
		}else{
			if(three >= two){
				output[i] = two + (three - two) * 2;
			}else{
				output[i] = -1;
			}
		}
	}
	myout(myconv(output,9));
}
function getPrimeFactorization(val){
  var primeMap = {};
  var div = 2;
  while(val != 1){
    if(val % div == 0){
      var count = 2;
      while(val % Math.pow(div, count) == 0){
         count++;
      }
      (primeMap[div] == null)  ? primeMap[div] = (count - 1) : primeMap[div] += (count - 1);
      val /= Math.pow(div, count - 1);
      if(isPrime(val)){
        (primeMap[val] == null)  ? primeMap[val] = 1 : primeMap[val]++;
        break;
      }
    }
    div = (div == 2) ? div + 1 : div + 2;
  }
  return primeMap;
}
function isPrime(val){
  if(val == null || val <= 1 || (val != 2 && val % 2 == 0)){
    return false;
  }else if(val == 2){
    return true;
  }
  var root = Math.floor(Math.sqrt(val));
  for(var i = 3; i <= root; i += 2){
    if(val % i == 0){
      return false;
    }
  }
  return true;
}

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

let stdinInput = '';

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

process.stdin.on('end', () => {
  main(stdinInput);
});

function main(data) {
    data = data.split('\n');
    const testCases = data[0] * 1;
    let i = 1;
    while (i <= testCases) {
      let n = +data[i];
      let check = false;
      let count = 0;
      while (true) {
        const mod = n % 6;
        if (n === 1) {
          console.log(count);
          break;
        } else if (mod && check) {
          console.log(-1);
          break;
        } else if (!mod) {
          n /= 6;
          check = false;
        }
        else {
          n *= 2;
          check = true;
        }
        count += 1;
      }
      i += 1;
    }
  }

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    function solve(x, moves) {
        console.log(x);
        if (x === 1) { return moves; }
        else if (x%2 === 1) { return solve(2*x, moves+1); }
        else if (x%6 === 0) { return solve(Math.floor(x/6), moves+1); }
        else { return -1; }
    }
    const testCases = parseInt(readline());
    for (var i=0; i<testCases; i++) {
        const x = parseInt(readline());
        console.log(solve(x, 0));
    }
}


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

function main(){
	let tests = parseInt(readline());
	while(tests--){
		let path = readline();
		let cntL = 0;
		let mx = 0;
		for(let i = 0; i < path.length; i++){
			let char = path[i];
			if(char == 'R'){
				cntL = 0;
			}
			else{
				cntL++;
				mx = Math.max(mx, cntL);
			}
		}
		console.log(mx + 1);
	}
}

// Problem Link: https://codeforces.com/contest/1324/problem/C
// Solution Link:

'use strict';

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

let inputString = '';
let currentLine = 0;
const INF = Math.pow(10, 12);

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

let results = [];

const getInput = () => {
    const lineInput = readline();
    const testCase = parseInt(lineInput);

    for(let i = 0; i < testCase; i++){
        const lineInput = readline() + "R";
        results.push(calculateJumpRange(lineInput));
    }

};

const isPossible = (moveSequence, jumpRange) => {
    let currentPos = -1
    while(currentPos < moveSequence.length - 1){
        let nextPos = -1;
        for(let i = currentPos + 1; i < Math.min(currentPos + jumpRange + 1, moveSequence.length); i++){
            if(moveSequence[i] === "R"){
                nextPos = i;
                break;
            }
        }

        if(nextPos === -1)
            return false;
        currentPos = nextPos;
    }

    return true;
}

const calculateJumpRange = (moveSequence) => {

    let low = 1, high = moveSequence.length + 1;
    let len = high;
    while(low <= high) {
        let mid = Math.floor((low + high) / 2);

        if(isPossible(moveSequence, mid))
            len = mid, high = mid - 1;
        else
            low = mid + 1;
    }

    return len;
}

function main() {
    getInput();
    for(let r of results)
        console.log(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) {
  let t = readInt(input)
  while(t--) {
    let s = readString(input) + 'R'
    let min = -Infinity
    let count = 0
    const length = s.length
    for(let i = 0; i < length; i++) {
      // console.log(i, count, min)
      if(s[i] === 'L') count++
      else {
        min = min < count + 1 ? count + 1 : min
        count = 0
      }
    }
    wr(min)
  }
}

const readline = require('readline')
const rl = readline.createInterface(process.stdin, process.stdout)

const input = []

rl.on('line', line => input.push(line.toString()))

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

const solve = () => {
  const t = Number(input[0])

  for (let testCase = 1; testCase <= t; testCase++) {
    const s = 'R' + input[testCase] + 'R'

    const arr = s
      .split('')
      .map((char, index) => (char === 'R' ? index : -1))
      .filter(num => ~num)

    d = 0

    for (let i = 1; i < arr.length; i++) {
      d = Math.max(d, arr[i] - arr[i - 1])
    }

    console.log(d)
  }
}

'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() {
  let t = getInt()
  while (t --> 0) {
    const s = 'R' + getLine() + 'R'
    const n = s.length
    let last = 0
    let ans = 0
    for (let i = 1; i < n; ++i) {
      if (s[i] === 'R') {
        ans = Math.max(ans, i - last)
        last = i
      }
    }
    print(ans)
  }
}

var t = Number(readline());
for (var k=0;k<t;k++){
 var s = readline();
 var n = s.length;
 var m = 0;
 var r = 1;
 for(var i=0;i<n;i++){
  if(s[i]=='R'){
   if(r>m){m=r;}
   r=1;
  }
  else{
   r++;
  }
 }
 print((r>m)?r:m);
}

Main();
function myout(t){print(t);}//standard output
function next(){return readline();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す
//6:1文字に分割  7:1文字に分割し、数値配列へ
//8:半角SPで結合　9:改行で結合　0:文字なしで結合
//atcoderのサンプルは最後に改行入れること
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main() {
    var t = nextInt();
    var output = new Array(t);
    for(var i = 0; i < t; i++){
        var s = nextCharArray();
        var len = s.length;
        var max = 0;//renzokuLnoMax + 1
        var count = 0;
        for(var j = 0; j < len; j++){
            if(s[j] == "L"){
                count++;
            }else{
                max = Math.max(max,count + 1);
                count = 0;
            }
        }
      	max = Math.max(max,count + 1);
        output[i] = max;
    }
    myout(myconv(output,9));
}

var t = parseInt(readline());

for (var i = 0; i < t; i++) {
  var s = readline();

  var ara = [];
  ara.push(0);
  for (var j = 0; j < s.length; j++) {
    if (s[j] == "R") ara.push(j + 1);
  }
  ara.push(s.length + 1);

  var max = ara[1] - ara[0];
  for (var j = 0; j < ara.length - 1; j++) {
    var diff = ara[j + 1] - ara[j];
    if (diff > max) max = diff;
  }

  print(max);
}

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

function main(){
	let tests = parseInt(readline());
	while(tests--){
		let path = readline();
		let cntL = 0;
		let mx = 0;
		[...path].forEach(char => {
			if(char == 'R'){
				cntL = 0;
			}
			else{
				cntL++;
				mx = Math.max(mx, cntL);
			}
		});
		console.log(mx + 1);
	}
}

var t = parseInt(readline());

for (var i = 0; i < t; i++) {
  var s = readline();

  var ara = [];
  ara.push(0);
  for (var i = 0; i < s.length; i++) {
    if (s[i] == "R") ara.push(i + 1);
  }
  ara.push(s.length + 1);

  var max = ara[1] - ara[0];
  for (var j = 0; j < ara.length - 1; j++) {
    var diff = ara[j + 1] - ara[j];
    if (diff > max) max = diff;
  }

  print(max);
}

var t = parseInt(readline());

for (var i = 0; i < t; i++) {
  var s = readline();

  var ara = [];
  ara.push(0);
  for (var i = 0; i < s.length; i++) {
    if (s[i] == "R") ara.push(i + 1);
  }
  ara.push(s.length + 1);

  var max = ara[1] - ara[0];
  for (var i = 0; i < ara.length - 1; i++) {
    var diff = ara[i + 1] - ara[i];
    if (diff > max) max = diff;
  }

  print(max);
}

const readline = require('readline')
const rl = readline.createInterface(process.stdin, process.stdout)

const input = []

rl.on('line', line => input.push(line.toString()))

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

const binarySearch = s => {
  const isFeasible = maxStep => {
    let visited = Array(s.length + 1).fill(false)

    const dfs = u => {
      visited[u] = true

      if (s[u] === 'R') {
        for (let step = 1; step <= maxStep; step++) {
          const v = u + step

          if (v < s.length && v >= 0 && !visited[v]) {
            dfs(v)
          }
        }
      }
    }

    dfs(0)
    return visited[s.length]
  }

  let low = 0
  let high = s.length
  let d = -1

  while (low <= high) {
    const mid = Math.floor((low + high) / 2)

    if (isFeasible(mid)) {
      d = mid
      high = mid - 1
    } else {
      low = mid + 1
    }
  }

  return d
}

const solve = () => {
  const t = Number(input[0])

  for (let testCase = 1; testCase <= t; testCase++) {
    const s = input[testCase]
    const d = binarySearch('R' + s)
    console.log(d)
  }
}


function intersection (a, b) {
	for (var i = 0, _i = a.length; i < _i; i++)
		if (b.indexOf(a[i]) !== -1) return true;
	return false;
}

function merge (a, b) {
	for (var i = 0, _i = a.length; i < _i; i++)
		if (b.indexOf(a[i]) === -1) b.push(a[i]);
	return b;
}

;(function () {

	print((function (n, m) {

		for (var i = 0, a = []; i <= m; i++) a[i] = [];

		for (var i = 0; i < n; i++) {
			var s = readline();
			if (s[0] == '0') a[0].push(i);
			else for (var j = 1, s = s.split(' '), _j = s.length; j < _j; j++) a[+s[j]].push(i);
		}

		var sub = a[0].length;
		a.shift(0);

		a = a.filter(function (e) { return e.length; });

		var flag = true;
		while (flag) {
			flag = false;
			for (var i = 0, _i = a.length; i < _i; i++) {
				for (var j = 0; j < _i; j++)
					if (i !== j && intersection(a[i], a[j])) {
						a[i] = merge(a[i], a[j]);
						a.splice(j, 1);
						flag = true;
						break;
					}
				if (flag) break;
			}
		}

		return sub + a.length - !!a.length;

	}).apply(this, readline().split(' ').map(Number)));

}).call(this);

const readline = require('readline');
const fs = require('fs');

const rl = readline.createInterface({
    input: process.stdin,
    // input: fs.createReadStream('src/0.input1.json'),
    output: process.stdout,
    terminal: false,
});

let lines = [];

/**
 * Time complexity:
 * Space complexity:
 */
rl.on('line', function (line) {
    lines.push(line.trim().split(' ').map(Number));
}).on('close', () => {
    const n = lines[0][0];
    const graph = {};

    let noOneKnow = true;
    // cover edge case, no one know any language
    for (let i = 1; i <= n; i++) {
        if (lines[i][0] > 0) {
            noOneKnow = false;
        }
    }
    if (noOneKnow) {
        console.log(n);
        return;
    }

    for (let i = 1; i < lines.length; i++) {
        lines[i].shift();
        graph[`${i}E`] = (graph[`${i}E`] || []).concat(lines[i]);
        for (let j = 0; j < lines[i].length; j++) {
            graph[lines[i][j]] = (graph[lines[i][j]] || []).concat(`${i}E`);
        }
    }

    const visited = {};
    for (let v in graph) {
        visited[v] = false;
    }

    const bfs = (s, graph) => {
        const queue = [s];

        while (queue.length > 0) {
            const u = queue.shift();
            for (let i = 0; i < graph[u].length; i++) {
                const v = graph[u][i];
                if (!visited[v]) {
                    visited[v] = true;
                    queue.push(v);
                }
            }
        }
    };

    let count = 0;
    for (let i = 1; i <= n; i++) {
        if (!visited[`${i}E`]) {
            count++;
            bfs(`${i}E`, graph);
        }
    }

    console.log(count - 1);
});

function intersection (a, b) {
	for (var i = 0, _i = a.length; i < _i; i++)
		if (b.indexOf(a[i]) !== -1) return true;
	return false;
}

function merge (a, b) {
	for (var i = 0, _i = a.length; i < _i; i++)
		if (b.indexOf(a[i]) === -1) b.push(a[i]);
	return b;
}

;(function () {

	print((function (n, m) {

		for (var i = 0, a = []; i <= m; i++) a[i] = [];

		for (var i = 0; i < n; i++) {
			var s = readline().split(' ');
			if (s[0] === '0') a[0].push(i);
			else for (var j = 1, _j = s.length; j < _j; j++) a[+s[j]].push(i);
		}

		var sub = a[0].length;
		a[0] = false;

		var flag = true;
		while (flag) {
			flag = false;
			for (var i = 1, _i = a.length; i < _i; i++) {
				if (intersection(a[i - 1], a[i])) {
					a[i] = merge(a[i], a[i - 1]);
					a[i - 1] = false;
					flag = true;
					a = a.filter(function (e) { return e !== false; });
					break;
				}
			}
		}

		a = a.filter(function (e) { return e.length; });

		return sub + a.length - 1;

	}).apply(this, readline().split(' ').map(Number)));

}).call(this);

function intersection (a, b) {
	for (var i = 0, _i = a.length; i < _i; i++)
		if (b.indexOf(a[i]) !== -1) return true;
	return false;
}

function merge (a, b) {
	for (var i = 0, _i = a.length; i < _i; i++)
		if (b.indexOf(a[i]) === -1) b.push(a[i]);
	return b;
}

;(function () {

	print((function (n, m) {

		for (var i = 0, a = []; i <= m; i++) a[i] = [];

		for (var i = 0; i < n; i++) {
			var s = readline().split(' ');
			if (s[0] === '0') a[0].push(i);
			else for (var j = 1, _j = s.length; j < _j; j++) a[+s[j]].push(i);
		}

		var sub = a[0].length;
		a[0] = false;

		var flag = true;
		while (flag) {
			flag = false;
			for (var i = 1, _i = a.length; i < _i; i++) {
				if (intersection(a[i - 1], a[i])) {
					a[i] = merge(a[i], a[i - 1]);
					a[i - 1] = false;
					flag = true;
					a = a.filter(function (e) { return e !== false; });
					break;
				}
			}
		}

		a = a.filter(function (e) { return e.length; });

		return sub + a.length - !!a.length;

	}).apply(this, readline().split(' ').map(Number)));

}).call(this);

const readline = require('readline');
const fs = require('fs');

const rl = readline.createInterface({
    input: process.stdin,
    // input: fs.createReadStream('src/0.input1.json'),
    output: process.stdout,
    terminal: false,
});

let lines = [];

const calculate = (arr) => {
    const sortedArr = arr.map((value, idx) => ({ value, idx: idx + 1 })).sort((a, b) => a.value - b.value);

    const result = [];
    const originalSorted = [sortedArr[0].idx];

    for (let i = 0; i < sortedArr.length - 1; i++) {
        originalSorted.push(sortedArr[i + 1].idx);
        if (sortedArr[i].value === sortedArr[i + 1].value) {
            const newArr = [];
            // clone a new arr
            for (let j = 0; j < sortedArr.length; j++) {
                if (j !== i) {
                    newArr.push(sortedArr[j].idx);
                } else {
                    newArr.push(sortedArr[j + 1].idx);
                    newArr.push(sortedArr[j].idx);
                    j++;
                }
            }
            result.push(newArr);
        }
    }

    result.push(originalSorted);
    return result;
};

/**
 * Time complexity:
 * Space complexity:
 */
rl.on('line', function (line) {
    lines.push(line.trim().split(' ').map(Number));
}).on('close', () => {
    const arr = lines[1];

    if (arr.length < 3) {
        console.log('NO');
    }

    const result = calculate(arr);

    if (result && result.length >= 3) {
        console.log('YES');
        result.forEach((item) => console.log(item.join(' ')));
    } else {
        console.log('NO');
    }
});


function readStringArray() {
    return readline().split(" ");
  }
  function readNumArray() {
    return readStringArray().map(Number);
  }

  function main() {
    var testCasesNum = +readline();
    for (var i = 0; i < testCasesNum; i++) {
      var abcm = readNumArray();
      var a = abcm[0];
      var b = abcm[1];
      var c = abcm[2];
      var m = abcm[3];
      var max = Math.max(a, b, c);
      var minPairs = max - (a + b + c - max) - 1;
      if (m > a - 1 + b - 1 + c - 1 || m < minPairs) {
        print('NO');
        continue;
      }

      print('YES');
    }
  }

  main();

/* Common Template Starts */
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++];
}
/* Common Template Ends */
function main() {
  let Q = +(readline()); // Read Input

  for (let i = 0; i < Q; i++) {
    const N = readline();

    const [a, b, c, m] = N.split(" ").map((n) => parseInt(n));
    const sorted = [a, b, c].sort((a, b) => a - b);

    const max = (a-1) + (b-1) + (c-1);
    const min = (sorted[2] - 1) - (sorted[0] + sorted[1]);
    //console.log("min max", min, max);

    if (m >= min && m <= max) {
      console.log("YES");
    } else {
      console.log("NO");
    }
  }
}

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

const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [a, b, c, m] = readline()
      .trim()
      .split(" ")
      .map((cur) => parseInt(cur));
    let max = a + b + c - 3;
    let arr = [a, b, c];
    let min;
    arr.sort((a, b) => b - a);
    let n = a + b + c;
    if (2 * (arr[1] + arr[2]) >= n) min = 0;
    else min = n - 2 * (arr[1] + arr[2]) - 1;
    if (m >= min && m <= max) console.log("YES");
    else console.log("NO");
  }
};
solve();

/* Common Template Starts */
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++];
}
/* Common Template Ends */
function main() {
  let Q = +(readline()); // Read Input

  for (let i = 0; i < Q; i++) {
    const N = readline();

    const [a, b, c, m] = N.split(" ").map((n) => parseInt(n));
    const sorted = [a, b, c].sort();

    const max = (a-1) + (b-1) + (c-1);
    const min = (sorted[2] - 1) - (sorted[0] + sorted[1]);
    //console.log("min max", min, max);

    if (m >= min && m <= max) {
      console.log("YES");
    } else {
      console.log("NO");
    }
  }
}


var n = +readline();
var arr = [];
for(var i=0;i<n;i++)
arr.push(readline());
print(main(n, arr));
function main(n, arr) {
	var ms = {}, fs = {};
	arr.forEach(function(p){
		var p = p.split(' ');
		for (var i = +p[1]; i<=+p[2]; i++)
		{
			if (p[0]=='M')
				ms[i] = (ms[i]|0)+1;
			else
				fs[i] = (fs[i]|0)+1;
		}
	});
	var ans = 0;
	for(var i = 1; i<=366; i++){
		ans = Math.max(ans, Math.min(ms[i]|0, fs[i]|0));
	}
	return ans*2;
}

var n = Number(readline()); //number of friends

var avail = [];
var days = [];

var isInArray = function(value, array) {
  return array.indexOf(value) > -1;
}

for (var i = 0; i < n; i++) {
	avail[i] = readline().split(' ');

	if (isInArray(avail[i][1], days) === false) {
		days.push(avail[i][1]);
	}
	if (isInArray(avail[i][2], days) === false) {
		days.push(avail[i][2]);
	}
}

//sorting the days
days.sort(function(a, b) {return a - b});

var count_M = 0;
var count_F = 0;
var guests = 0;
var max_guests = 0;

// each iteration in this loop is a new day
for (var i = 0; i < days.length; i++) {

	// setting counters back to 0 each new day
	count_M = 0;
	count_F = 0;

	// each iteration in this loop is a new person --> checking every person on each day
	for (var j = 0; j < n; j++) {
		// checking availability of each person
		if (Number(days[i]) >= Number(avail[j][1]) && Number(days[i]) <= Number(avail[j][2])) {
			//for each person available that day check if male or female and add counter
			if (avail[j][0] == 'M') {
				count_M += 1;
			} else {
				count_F += 1;
			}
		}
	}
	// determining number of Female + Male pairs (*2 to get # of people)
	guests = Math.min(count_M, count_F) * 2;
	if (guests > max_guests) {
		max_guests = guests;
	}
}

print(max_guests);

'use strict';

const n = Number(readline());
let dates = Array(400).fill(0);

for (let i = 0; i < n; i++) {
  const line = readline().split(' ')

  for (let j = Number(line[1]); j < Number(line[2])+1; j++) {
    dates[j] += line[0] === 'M' ? 1 : 10000;
  }
}

let _dates = [...new Set(dates)]

let result = 0;
while (_dates.length !== 0) {
  let _result = _dates.pop();
  result = Math.max(result, Math.min(_result/10000|0, _result%10000));
}

print(result * 2);

var n = Number(readline());
var sex = new Array(n);
var l = new Array(n);
var r = new Array(n);
for (var i = 0; i < n; ++i) {
    var str = readline().split(" ", 3);
    sex[i] = str[0];
    l[i] = Number(str[1]);
    r[i] = Number(str[2]);
}

var ans = 0;
for (var i = 1; i <= 366; ++i) {
    var a = 0, b = 0;
    for (var j = 0; j < n; ++j) {
        if (l[j] <= i && r[j] >= i) {
            if (sex[j] == "M") {
                ++a;
            } else {
                ++b;
            }
        }
    }
    ans = Math.max(ans, Math.min(a, b) * 2);
}
print(ans);

var readInt = () => parseInt(readline())
var readIntArray = () => readline().split(' ').forEach(item => parseInt(item))
Array.prototype.fill = function(value) {
    for (var i = 0; i < this.length; i++)
        this[i] = value
    return this
}

var N = readInt()
var boys = (new Array(366)).fill(0)
var girls = new Array(366).fill(0)

for (var  i = 0; i < N; i++) {
    var f = readline().split(' ')
    var a = (f[0] === 'M' ? boys : girls)

    for (var n = parseInt(f[2]), j = parseInt(f[1])-1; j < n; j++) {
        a[j] += 1
    }
}
var ans = 0
for (var i = 0; i < 366; i++) {
    ans = Math.max(ans, 2*Math.min(boys[i], girls[i]))
}
print(ans)

var n = +readline();
var arr = [];
for(var i=0;i<n;i++)
arr.push(readline());
print(main(n, arr));
function main(n, arr) {
	var ms = {}, fs = {};
	arr.forEach(function(p){
		var p = p.split(' ');
		for (var i = +p[1]; i<=+p[2]; i++)
		{
			if (p[0]=='M')
				ms[i] = (ms[i]|0)+1;
			else
				fs[i] = (fs[i]|0)+1;
		}
	});
	var ans = 0;
	for(var i = 1; i<366; i++){
		ans = Math.max(ans, Math.min(ms[i]|0, fs[i]|0));
	}
	return ans*2;
}

'use strict';

const n = Number(readline());
let dates = Array(400).fill(0);

for (let i = 0; i < n; i++) {
  const line = readline().split(' ')

  for (let j = Number(line[1]); j < Number(line[2])+1; j++) {
    dates[j] += line[0] === 'M' ? 1 : 10000;
  }
}

let _dates = [...new Set(dates)]
_dates.sort()

let result = 0;
while (_dates) {
  let _result = _dates.pop();
  if (_result % 10001 === 0) {
    result = 2 * _result/10001;
    break;
  }
}

print(result);

var n = Number(readline());
var sex = new Array(n);
var l = new Array(n);
var r = new Array(n);
for (var i = 0; i < n; ++i) {
    var str = readline().split(" ", 3);
    sex[i] = str[0];
    l[i] = Number(str[1]);
    r[i] = Number(str[2]);
}

var ans = 0;
for (var i = 1; i <= 366; ++i) {
    var a = 0, b = 0;
    for (var j = 0; j < n; ++j) {
        if (l[j] <= i && r[j] >= i) {
            if (sex[j] == "M") {
                ++a;
            } else {
                ++b;
            }
        }
    }
    ans = Math.max(ans, Math.min(a, b));
}
print(ans);


var l = readline().split(' ')
var i, j
var t = l[0]
var mt = l[1]
var m = []
var b = []
var bn = 0
var r

for (i = 0; i < mt; i++) m[i] = 0

for (i = 0; i < t; i++) {
  l = readline().split(' ')
  var op = l[0]
  var n = l[1]
  if (op == 'alloc') {
    print(r = alloc(n))
  } else if (op == 'erase') {
    r = erase(n)
    if (r) print(r)
  } else if (op == 'defragment') {
    defragment()
  }
}

function alloc (n) {
  var i, j = 0
  for (i = 0; i < mt; i++) {
    if (!m[i]) {
      j++
      if (j == n) {
        b[++bn] = [i - j + 1, i]
        while (j > 0) {
          m[i - j + 1] = 1
          j--
        }
        return bn
      }
    } else {j = 0}
  }
  return 'NULL'
}

function erase (n) {
  if (b[n]) {
    for (var i = b[n][0]; i <= b[n][1]; i++) m[i] = 0
    b[n] = null
  } else {
    return 'ILLEGAL_ERASE_ARGUMENT'
  }
}

function defragment () {
  var j = 0
  for (var i = 0; i < mt; i++) {
    if (!m[i]) {j++}
    else if (j) {
      var mmb
      for (var t = 0; t <= bn; t++) {
        if (b[t] && b[t][0] == i) {
          mmb = b[t]
          break
        }
      }
      for (var k = mmb[0]; k <= mmb[1]; k++) {
        m[k] = 0
        m[k - j] = 1
      }
      mmb[0] -= j
      mmb[1] -= j
      j = 0
    }
  }
}

var s = readline().split( ' ' ),
    size = s[1] - '';

var mem = [];

for (; s = readline(); ) {
    switch (s.charAt( 0 )) {
        case 'a': alloc( s.replace( 'alloc ', '' ) - '' ); break;
        case 'e': erase( s.replace( 'erase ', '' ) - '' ); break;
        default: defragment();
    }
}

function alloc(x) {
    var next = alloc._ = alloc._ || 1;
    for (var i=1, j=0; i<size+1 && j<x; i++) {
        j = !!mem[i] ? 0 : j+1;
    }

    if (x === j) {
        alloc._++;
        print( next );
        for (j=i, i=i-x; i<j; i++) {
            mem[i] = next;
        }
    } else {
        print( 'NULL' );
    }
}

function erase(x) {
    for (var i=1, j=0; i<size+1; i++) {
        if (mem[i] === x) {
            mem[i] = 0; j = i;
        }
    }

    !j && print( 'ILLEGAL_ERASE_ARGUMENT' );
}

function defragment() {
    for (var j=1, i=1; i<size+1; i++) {
        if (!!mem[i]) {
            mem[j++] = mem[i]; j !== i+1 && (mem[i] = 0);
        }
    }
}

var a = readline().split(' ').map(function (e){
	return parseInt(e);
});
var n = a[0], m = a[1];
var mem = [{
	'id': NaN,
	'begin': 0,
	'end': 0
}], cnt = 0;
function alloc(i, len) {
	mem.splice(i, 0, {
		'id': ++cnt,
    	'begin': mem[i - 1].end + 1,
    	'end': mem[i - 1].end + len,
    });
    print(cnt);
}
for (var i = 0; i < n; ++i) {
	a = readline().split(' ');
	switch (a[0]) {
    	case 'alloc': {
    		var find = false;
        	var len = parseInt(a[1]);
        	for (var j = 0; j < mem.length - 1; ++j) {
       	        if (mem[j + 1].begin - 1 - mem[j].end >= len) {
                	alloc(j + 1, len);
                	find = true; break;
                }
            }
            if (!find) {
            	if (m - mem[mem.length - 1].end >= len) {
	            	alloc(mem.length, len);
	            } else {
                    print('NULL');
                }
            }
        } break;
        case 'erase': {
        	var id = parseInt(a[1]);
        	var find = false;
        	for (var j = 0; j < mem.length; ++j) {
            	if (mem[j]['id'] === id) {
                	mem.splice(j, 1);
                	find = true; break;
                }
            }
            if (!find) {
            	print('ILLEGAL_ERASE_ARGUMENT');
            }
        } break;
        case 'defragment': {
        	for (var j = 1; j < mem.length; ++j) {
        		var len = mem[j].end - mem[j].begin;
            	mem[j].begin = mem[j - 1].end + 1 || 1;
            	mem[j].end = mem[j].begin + len;
            }
        } break;
    }
}

var l = readline().split(' ')
var i, j
var t = l[0]
var mt = l[1]
var m = []
var b = []
var bn = 0

for (i = 0; i < mt; i++) m[i] = 0

for (i = 0; i < t; i++) {
  l = readline().split(' ')
  var op = l[0]
  var n = l[1]
  if (op == 'alloc') {
    print(alloc(n))
  } else if (op == 'erase') {
    var r = erase(n)
    if (r) print(r)
  } else if (op == 'defragment') {
    defragment()
  }
}

function alloc (n) {
  var i, j = 0
  for (i = 0; i < mt; i++) {
    if (!m[i]) {
      j++
      if (j == n) {
        b[++bn] = [i - j + 1, i]
        while (j > 0) {
          m[i - j + 1] = 1
          j--
        }
        return bn
      }
    } else {j = 0}
  }
  return 'NULL'
}

function erase (n) {
  if (b[n]) {
    for (var i = b[n][0]; i <= b[n][1]; i++) m[i] = 0
    b[n] = null
  } else {
    return 'ILLEGAL_ERASE_ARGUMENT'
  }
}

function defragment () {
  var j = 0
  for (var i = 0; i < mt; i++) {
    if (!m[i]) {j++}
    else if (j) {
      var mmb
      for (var t = 0; t <= bn; t++) {
        if (b[t] && b[t][0] == i) {
          mmb = b[t]
          break
        }
      }
      for (var k = mmb[0]; k < mmb[1]; k++) {
        m[k] = 0
        m[k - j] = 1
      }
      mmb[0] -= j
      mmb[1] -= j
      j = 0
    }
  }
}

var a = readline().split(' ').map(function (e){
	return parseInt(e);
});
var n = a[0], m = a[1];
var mem = [{
	'id': NaN,
	'begin': 0,
	'end': 0
}], cnt = 0;
function alloc(i, len) {
	mem.splice(i, 0, {
		'id': ++cnt,
    	'begin': mem[i - 1].end + 1,
    	'end': mem[i - 1].end + len,
    });
    print(cnt);
}
for (var i = 0; i < n; ++i) {
	a = readline().split(' ');
	switch (a[0]) {
    	case 'alloc': {
    		var find = false;
        	var len = parseInt(a[1]);
        	for (var j = 0; j < mem.length - 1; ++j) {
       	        if (mem[j + 1].begin - mem[j].end > len) {
                	alloc(j + 1, len);
                	find = true; break;
                }
            }
            if (m - mem[mem.length - 1].end >= len) {
            	alloc(mem.length, len);
            	find = true;
            }
            if (!find) {
            	print('NULL');
            }
        } break;
        case 'erase': {
        	var id = parseInt(a[1]);
        	var find = false;
        	for (var j = 0; j < mem.length; ++j) {
            	if (mem[j]['id'] === id) {
                	mem.splice(j, 1);
                	find = true; break;
                }
            }
            if (!find) {
            	print('ILLEGAL_ERASE_ARGUMENT');
            }
        } break;
        case 'defragment': {
        	for (var j = 1; j < mem.length; ++j) {
        		var len = mem[j].end - mem[j].begin;
            	mem[j].begin = mem[j - 1].end + 1 || 1;
            	mem[j].end = mem[j].begin + len;
            }
        } break;
    }
}

var a = readline().split(' ').map(function (e){
	return parseInt(e);
});
var n = a[0], m = a[1];
var tot = 0, top = 0;
var arr = [null];
for (var i = 0; i < n; ++i) {
	a = readline().split(' ');
	switch (a[0]) {
    	case 'alloc': {
        	var len = parseInt(a[1]);
        	if (top + len <= m && len > 0) {
            	tot += len; top += len;
            	print(arr.length);
            	arr.push(len);
        	} else {
            	print('NULL');
            }
        } break;
        case 'erase': {
        	var id = parseInt(a[1]);
        	if (!arr[id]) {
            	print('ILLEGAL_ERASE_ARGUMENT');
            } else {
           	    tot -= arr[id];
            	if (id === arr.length - 1) {
                	top -= arr.pop();
                } else {
                    arr[id] = null;
                }
            }
        } break;
        case 'defragment': {
        	top = tot;
        } break;
    }
}

var a = readline().split(' ').map(function (e){
	return parseInt(e);
});
var n = a[0], m = a[1];
var tot = 0, top = 0;
var arr = [null];
for (var i = 0; i < n; ++i) {
	a = readline().split(' ');
	switch (a[0]) {
    	case 'alloc': {
        	var len = parseInt(a[1]);
        	if (top + len <= m && len > 0) {
            	tot += len; top += len;
            	print(arr.length);
            	arr.push(len);
        	} else {
            	print('NULL');
            }
        } break;
        case 'erase': {
        	var id = parseInt(a[1]);
        	if (!arr[id]) {
            	print('ILLEGAL_ERASE_ARGUMENT');
            } else {
           	    tot -= arr[id];
            	if (id === arr.length - 1) {
                	top -= arr[id];
                }
                arr[id] = null;
            }
        } break;
        case 'defragment': {
        	top = tot;
        } break;
    }
}

var a = readline().split(' ').map(function (e){
	return parseInt(e);
});
var n = a[0], m = a[1];
var tot = 0, top = 0;
var arr = [null];
for (var i = 0; i < n; ++i) {
	a = readline().split(' ');
	switch (a[0]) {
    	case 'alloc': {
        	var len = parseInt(a[1]);
        	if (top + len <= m) {
            	tot += len; top += len;
            	print(arr.length);
            	arr.push(len);
        	} else {
            	print('NULL');
            }
        } break;
        case 'erase': {
        	var id = parseInt(a[1]);
        	if (!arr[id]) {
            	print('ILLEGAL_ERASE_ARGUMENT');
            } else {
            	tot -= arr[id];
                arr[id] = null;
            }
        } break;
        case 'defragment': {
        	top = tot;
        } break;
    }
}

var a = readline().split(' ').map(function (e){
	return parseInt(e);
});
var n = a[0], m = a[1];
var mem = [{
	'id': NaN,
	'begin': 0,
	'end': 0
}], cnt = 0;
function alloc(i, len) {
	mem.splice(i, 0, {
		'id': ++cnt,
    	'begin': mem[i - 1].end + 1,
    	'end': mem[i - 1].end + len,
    });
    print(cnt);
}
for (var i = 0; i < n; ++i) {
	a = readline().split(' ');
	switch (a[0]) {
    	case 'alloc': {
    		var find = false;
        	var len = parseInt(a[1]);
        	for (var j = 0; j < mem.length - 1; ++j) {
       	        if (mem[j + 1].begin - mem[j].end > len) {
                	alloc(j + 1, len);
                	find = true; break;
                }
            }
            if (m - mem[mem.length - 1].end > len) {
            	alloc(mem.length, len);
            	find = true;
            }
            if (!find) {
            	print('NULL');
            }
        } break;
        case 'erase': {
        	var id = parseInt(a[1]);
        	var find = false;
        	for (var j = 0; j < mem.length; ++j) {
            	if (mem[j]['id'] === id) {
                	mem.splice(j, 1);
                	find = true; break;
                }
            }
            if (!find) {
            	print('ILLEGAL_ERASE_ARGUMENT');
            }
        } break;
        case 'defragment': {
        	for (var j = 1; j < mem.length; ++j) {
        		var len = mem[j].end - mem[j].begin;
            	mem[j].begin = mem[j - 1].end + 1 || 1;
            	mem[j].end = mem[j].begin + len;
            }
        } break;
    }
}

var a = readline().split(' ').map(function (e){
	return parseInt(e);
});
var n = a[0], m = a[1];
var tot = 0, top = 0;
var arr = [-1];
for (var i = 0; i < n; ++i) {
	a = readline().split(' ');
	switch (a[0]) {
    	case 'alloc': {
        	var len = parseInt(a[1]);
        	if (top + len <= m) {
            	tot += len; top += len;
            	print(arr.length);
            	arr.push(len);
        	} else {
            	print('NULL');
            }
        } break;
        case 'erase': {
        	var id = parseInt(a[1]);
        	if (!arr[id]) {
            	print('ILLEGAL_ERASE_ARGUMENT');
            } else {
            	tot -= arr[id];
                arr[id] = null;
            }
        } break;
        case 'defragment': {
        	top = tot;
        } break;
    }
}


var t=Number(readline());
for (var i=0; i<t; i++) {
    var n=Number(readline());
    var w=readline().split(" ").map(Number).filter(x=>x%2==1);
    if (w.length==n) {
        print("YES");
    }
    else {
        print("NO");
    }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

// End of Codeforces interface

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

  for (let i = 0; i < testCaseCount; i++) {
    readline();
    const numberSet = readline().split(" ").map(n => parseInt(n));
    let evenCount = 0;
    let oddCount = 0;

    for (let number of numberSet) {
      if (number % 2 === 0) {
        evenCount += 1;
      } else {
        oddCount += 1;
      }
    }

    if (evenCount === oddCount) {
      console.log('Yes');
    } else {
      console.log('No');
    }
  }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main()
});

function readline() {
  return inputString[currentLine++]
}
// Make a Snippet for the code above this and then write your logic in main();

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

// function to solve problems
function solve (){
  let n = readline()
  n = +n
  let odd = 0, even = 0
  let arr = readline().split(' ').map(x => {
    (x % 2 == 0) ? even++ : odd++
    return +x
  })
  if (odd == even) {
    console.log('YES')
  } else {
    console.log('NO')
  }
}

function sortAscending(a, b) {
  return a[0] - b[0]
}
// String.prototype.replaceAt = function (index, replacement) {
//   return this.substring(0, index) + replacement + this.substring(index + replacement.length)
// }

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

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => {
        let next;
        do {
            next = (await getLineGen.next());
        } while (!next.done && next.value === '');
        return next.value;
    };
})();

let solve = async () => {
    const nsc = parseInt(await getLine());
    for(let sc = 0; sc < nsc; sc++) {
        const n = parseInt(await getLine());
        const arr = (await getLine()).split(' ').map(num => parseInt(num));
        let odd = 0, even = 0;
        for(let i = 0; i < arr.length; i++)
            if (arr[i] % 2 === 0)
                even++;
            else
                odd++;
        if (odd === even) {
            console.log('Yes');
        } else
            console.log('No');
    }
}

solve();

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0;
    var t = +lines[l++]
    for (var i = 0; i < t; i++) {
        var n = +lines[l++]
        var arr = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, arr))
    }
});

function solve(n, arr) {
    let odd = 0
    let even = 0
    for (let i = 0; i < arr.length; i++) {
        if (arr[i] & 1) {
            odd++
        } else {
            even++
        }
    }
    return odd === even ? 'Yes' : 'No'
}

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

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var N = nextInt();
		var list = nextIntArray(N * 2);
		var div = 0;
		for(var i = 0; i < N * 2; i++){
			if(list[i] % 2 == 0){
				div++;
			}else{
				div--;
			}
		}
		if(div == 0){
			myout("Yes");
		}else{
			myout("No");
		}
	}
}

function solution() {
  const n = readline();
  const arr = readline().split(' ').map(elem => +elem);

  return (arr.filter(elem => elem % 2 === 0).length === (arr.length >> 1)) ? 'Yes' : 'No';
}

function main(t) {
  for (var i = 0; i < t; i++) {
    print(solution());
  }
}

const t = readline();
main(t);

for(t=readline();t--;){
    readline()
    c=[0,0]
    readline().split(' ').forEach(e=>c[e%2]++)
    print(c[0]==c[1]?'Yes':'No')
}

var testCase = +readline()

for(var i=0;i<testCase;i++){
    var a=+readline(),counter=0
    var sequence=readline().split(" ").map(node=>+node)
    for(var j=0;j<sequence.length;j++){
        if(sequence[j]%2===0){
            counter++
        }else{
            counter--
        }
    }
    if(counter===0){
        print("Yes")
    }else{
        print("No")
    }
}

var t = Number(readline());

while (t--) {
    var n = Number(readline());
    var a = readline().split(" ");
    var evens = 0;
    var odds = 0;

    for (var i = 0; i < n * 2; i++) {
        if (Number(a[i]) % 2 == 0)
            evens++;
        else
            odds++;
    }

    evens == odds ? print("Yes") : print("No");
}

//JAI SHREE RAM//
var t;
t=readline();
while(t--)
{
var x,e=0,o=0;
x=readline();
var a= readline().split(' ').map(x=> parseInt(x));
for(var i=0;i<2*x;i++)
{
    if(a[i]%2===0)
    e++;
    else
    o++;
}
if(e==o)
print("YES");
else
print("NO");
}

t = +readline();

for (i = 0; i < t; i++) {
  n = +readline();
  a = readline().split(' ');
  a = a.map(Number);

  count = 0;
  for (j = 0; j < 2*n; j++) {
    if (a[j] % 2 === 0) {
      count++;
      if (count > n) {
        break;
      }
    }
  }

  if (count === n) {
    print('Yes');
  }
  else{
    print('No');
  }
}

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

function oddSet() {
  const n = readline();
  const arr = readline().split(' ').map(elem => +elem);

  return (arr.filter(elem => elem % 2 === 0).length === (arr.length >> 1)) ? 'Yes' : 'No';
}

function main() {
  const t = +readline();
  for (let i = 0; i < t; i++) {
    print(oddSet());
  }
}

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

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

let c = 0;

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

  if (c % 2 !== 0) {
    c++;
    return;
  }

  const numbers = d.split(" ").map(Number);
  let ans = 0;

  for (let i = 0; i < numbers.length; i++) {
    if (numbers[i] % 2) {
      ans++;
    } else {
      ans--;
    }
  }

  if (ans === 0) {
    console.log("YES");
  } else {
    console.log("NO");
  }

  c++;
});

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

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
function readLine() {
    return inputString[currentLine++];
};
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
    // cmd(not powershell): node cp.js < input.txt
});

function main() {
    let t = parseInt(readLine());
    while (t-- > 0) {
        solve();
    }
}
function solve() {
    let n = parseInt(readLine());
    let arr = readLine().split(" ");
    let even = 0, odd = 0;
    for (let i = 0; i < arr.length; i++) {
        let num = parseInt(arr[i]);
        if (num % 2 == 0) even++;
        else odd++;
    }
    if (even == odd) console.log("YES");
    else console.log("NO");
}

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {

    let t = parseInt(readLine());
    while (t--) {

        let n = parseInt(readLine());
        let a = readLine().split(" ").map(x => parseInt(x));
        solve(n, a);

    }
}

function solve(n, a) {
    let odd = 0, even = 0;
    for (let i of a) {
        if (i % 2) odd++;
        else even++;
    }
    if (odd == even) console.log("Yes");
    else console.log("No");
}

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

function main(input) {
    var args = input.split("\n");
    const t = parseInt(args[0], 10);
    for (var i = 1; i <= t; i++) {
        var n = parseInt(args[2 * i - 1], 10);
        var v = args[2 * i].split(" ").map((n) => parseInt(n, 10));
        var cnt = 0;
        for (var j = 0; j < 2 * n; j++) {
            if (v[j] % 2 === 1) {
                cnt++;
            }
        }
        if (cnt === n) {
            console.log("Yes");
        } else {
            console.log("No");
        }
    }
}

const stdin = process.openStdin();
let content = '';

stdin.addListener('data', (data) => {
          content += data;
})

stdin.addListener('end', () => {
          content = content.split('\n');
          content.shift();
          content = content.map((string) => string.substring(0, string.length - 1));
          content.pop();
          content.forEach((str, i) => {
                    if (i % 2 === 1) {
                              str = str.split(' ').map(str => parseInt(str));
                              if (oddSet(str)) {
                                        console.log('Yes');
                              } else {
                                        console.log('No');
                              }
                    }
          });
})

const oddSet = (arr) => {
          let oddNums = 0;
          arr.forEach((num) => {
                    if (num % 2 === 1) {
                              oddNums++;
                    }
          });
          return oddNums === Math.floor(arr.length / 2);
}

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(str => str.trim());

    main();
});

function readLine() {
    return inputString[currentLine++];
}
var gcd = function(a, b) {
    if (!b) {
      return a;
    }

    return gcd(b, a % b);
}

function main()
{
    //const name=readLine();
    //console.log(name);

    let test=readLine();
    while(test--)
    {
        n=parseInt(readLine());
        ara=readLine();
        ara=ara.split(" ");
        cnt=0;
        for(i=0;i<2*n;i++)
        {
            val=parseInt(ara[i]);
            if(val&1)
                cnt++;
        }
        if(cnt===n)
        {
            console.log("YES");
        }
        else
        {
            console.log("NO");
        }
    }
}

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

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

let nl = nextLine();

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

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

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

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

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

const sol = () => {
	//your code this
	let t = nl.num();
	let ans = [];
	for(let i = 0; i < t; i++){
		let n = nl.num();
		let a = nl.nums();
		let x = 0;
		a.forEach(e => {
			if (e%2 === 1) {
				x++;
			}
		});
		ans.push(x == n);
	}
	console.log(ans.map(e => e?'Yes':'No').join('\n'));
};

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

function gcd(x, y) {
   if (y === 0) {
      return x;
   }
   return gcd(y, x % y);
}

function div(a, b) {
   return Math.floor(a / b);
}

function solve() {
   var n = Number(read());
   var c = 0;
   readArray((x) => { if (Number(x) & 1) {
      c++;
   }});
   write(c === n ? 'Yes' : 'No');
}

function init() {
   var T;
   T = 1;
   T = Number(read());
   for (var t = 0; t < T; t++) {
      solve();
   }
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function readArray(f) {
   return read().split(' ').map(f);
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;

   var needWriteFile = false;

   var writeResult = '';
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
         if (needWriteFile) {
            fs.writeFile(path.join(__dirname, outTextName), writeResult, (err) => {
               err ? console.error(err) : console.log('good')
            });
         }
      });
   } else {
      MEMORY = fs.readFileSync(0, 'utf-8').split('\r\n');
      init();
   }
} else {
   init();
}

function write(value) {
   if (needWriteFile) {
      writeResult += value + '\n';
      return;
   }
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   return isNode && MEMORY;
}

function oddSet() {
  const n = readline();
  const arr = readline().split(' ').map(elem => +elem);

  return (arr.filter(elem => elem % 2 === 0).length === (arr.length >> 1)) ? 'Yes' : 'No';
}

function main(t) {
  for (let i = 0; i < t; i++) {
    print(oddSet());
  }
}

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0].split(' ').map(Number);
    var isOdd = false;
    for(var a = 1; a <= n * 2; a++){
        var k = lines[a].split(' ').map(Number);
        if(a % 2 === 0){
            for(var c = 0; c < k.length; c+=2){
                var d = k[c] + k[c+1];
                if(d % 2 === 1){
                    isOdd = true;
                    d = 0;
                }else{
                    isOdd = false;
                    break;
                }
            }
            if(isOdd === false){
                console.log('No');
            }else{
                console.log('Yes');
            }
        }

    }

});

for(t=readline();t--;){
    readline()
    c=[]
    readline().split(' ').forEach(e=>c[e%2]++)
    print(c[0]==c[1]?'Yes':'No')
}

for(t=readline;t--;){
    readline()
    c=[]
    readline().split(' ').forEach(e=>c[e%2]++)
    print(c[0]==c[1]?'Yes':'No')
}