It's a walking tour day in SIS.Winter, so $$$t$$$ groups of students are visiting Torzhok. Streets of Torzhok are so narrow that students have to go in a row one after another.Initially, some students are angry. Let's describe a group of students by a string of capital letters "A" and "P":   "A" corresponds to an angry student  "P" corresponds to a patient student Such string describes the row from the last to the first student.Every minute every angry student throws a snowball at the next student. Formally, if an angry student corresponds to the character with index $$$i$$$ in the string describing a group then they will throw a snowball at the student that corresponds to the character with index $$$i+1$$$ (students are given from the last to the first student). If the target student was not angry yet, they become angry. Even if the first (the rightmost in the string) student is angry, they don't throw a snowball since there is no one in front of them.Let's look at the first example test. The row initially looks like this: PPAP. Then, after a minute the only single angry student will throw a snowball at the student in front of them, and they also become angry: PPAA. After that, no more students will become angry.Your task is to help SIS.Winter teachers to determine the last moment a student becomes angry for every group.

The first line contains a single integer $$$t$$$ — the number of groups of students ($$$1 \le t \le 100$$$). The following $$$2t$$$ lines contain descriptions of groups of students. The description of the group starts with an integer $$$k_i$$$ ($$$1 \le k_i \le 100$$$) — the number of students in the group, followed by a string $$$s_i$$$, consisting of $$$k_i$$$ letters "A" and "P", which describes the $$$i$$$-th group of students.

For every group output single integer — the last moment a student becomes angry.

NoteIn the first test, after $$$1$$$ minute the state of students becomes PPAA. After that, no new angry students will appear.In the second tets, state of students in the first group is:   after $$$1$$$ minute — AAPAAPPAAPPP  after $$$2$$$ minutes — AAAAAAPAAAPP  after $$$3$$$ minutes — AAAAAAAAAAAP  after $$$4$$$ minutes all $$$12$$$ students are angry In the second group after $$$1$$$ minute, all students are angry.

var stdin = process.openStdin();

stdin.addListener("data", function(d) {
    const arr = d.toString().trim().split('\n').map(e => e.trim());
    for(let i=1; i < arr.length; i++){
        if(i % 2 === 0){
            console.log(findm(arr[i]));
        }
    }
});

function findm(students){
    let str = students;
    let counter = 0, j = 1;
    let arr = str.split(/A+/).map(e => e.length);
    let max = 0;
    for(let i = 1; i < arr.length; i++){
        if(max < arr[i]){
            max = arr[i];
        }
    }
    return max;
}

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

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

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

  let ans = 0;
  const startPoint = str.indexOf('A') > -1 ? str.indexOf('A') : str.length;

  for (let i = startPoint; i < str.length; i++) {
    let count = 0;

    while (str[i] === 'P') {
      count++;
      i++;
    }

    ans = Math.max(ans, count);
  }

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

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let T = -1;
let num = -1;
let last = 0;
rl.on('line', (line) => {
  if (T !== -1 && T % 2) {
    console.log(Array
      .from(line)
      .reduceRight((res, ele, index) => {
        if (ele === 'A') {
          res = Math.max(res, last - index - 1);
          last = index;
        }
        return res;
    }, 0))
  } else if (T !== -1) {
    num = line;
    last = num;
  }
  T ++;
})

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let T = -1;
let num = -1;
let last = 0;
rl.on('line', (line) => {
  if (T !== -1 && T % 2) {
    console.log(Array
      .from(line)
      .reduceRight((res, ele, index) => {
        if (ele === 'A') {
          res = Math.max(res, last - index - 1);
          last = index;
        } else {
          res = res;
        }
        return res;
    }, 0))
  } else if (T !== -1) {
    num = line;
    last = num;
  }
  T ++;
})

"use strict";var readline=require("readline");function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_nonIterableSpread()}function _arrayWithoutHoles(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}function _iterableToArray(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function __extends(t,e){function r(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function isFunction(t){return"function"==typeof t}var _enable_super_gross_mode_that_will_cause_bad_things=!1,config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;_enable_super_gross_mode_that_will_cause_bad_things=t},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}};function hostReportError(t){setTimeout((function(){throw t}),0)}var empty={closed:!0,next:function(t){},error:function(t){if(config.useDeprecatedSynchronousErrorHandling)throw t;hostReportError(t)},complete:function(){}},isArray=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}();function isObject(t){return null!==t&&"object"==typeof t}var UnsubscriptionErrorImpl=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n  "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),UnsubscriptionError=UnsubscriptionErrorImpl,Subscription=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var e;if(!this.closed){var r=this._parentOrParents,n=this._unsubscribe,o=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,r instanceof t)r.remove(this);else if(null!==r)for(var i=0;i<r.length;++i){r[i].remove(this)}if(isFunction(n))try{n.call(this)}catch(t){e=t instanceof UnsubscriptionError?flattenUnsubscriptionErrors(t.errors):[t]}if(isArray(o)){i=-1;for(var c=o.length;++i<c;){var a=o[i];if(isObject(a))try{a.unsubscribe()}catch(t){e=e||[],t instanceof UnsubscriptionError?e=e.concat(flattenUnsubscriptionErrors(t.errors)):e.push(t)}}}if(e)throw new UnsubscriptionError(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function flattenUnsubscriptionErrors(t){return t.reduce((function(t,e){return t.concat(e instanceof UnsubscriptionError?e.errors:e)}),[])}var rxSubscriber=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),Subscriber=function(t){function e(r,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=empty;break;case 1:if(!r){i.destination=empty;break}if("object"==typeof r){r instanceof e?(i.syncErrorThrowable=r.syncErrorThrowable,i.destination=r,r.add(i)):(i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,r));break}default:i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,r,n,o)}return i}return __extends(e,t),e.prototype[rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(Subscription),SafeSubscriber=function(t){function e(e,r,n,o){var i,c=t.call(this)||this;c._parentSubscriber=e;var a=c;return isFunction(r)?i=r:r&&(i=r.next,n=r.error,o=r.complete,r!==empty&&(isFunction((a=Object.create(r)).unsubscribe)&&c.add(a.unsubscribe.bind(a)),a.unsubscribe=c.unsubscribe.bind(c))),c._context=a,c._next=i,c._error=n,c._complete=o,c}return __extends(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=config.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):hostReportError(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;hostReportError(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),config.useDeprecatedSynchronousErrorHandling)throw t;hostReportError(t)}},e.prototype.__tryOrSetError=function(t,e,r){if(!config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return config.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(hostReportError(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(Subscriber);function canReportError(t){for(;t;){var e=t,r=e.closed,n=e.destination,o=e.isStopped;if(r||o)return!1;t=n&&n instanceof Subscriber?n:null}return!0}function toSubscriber(t,e,r){if(t){if(t instanceof Subscriber)return t;if(t[rxSubscriber])return t[rxSubscriber]()}return t||e||r?new Subscriber(t,e,r):new Subscriber(empty)}var observable=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function noop(){}function pipeFromArray(t){return t?1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}:noop}var Observable=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,o=toSubscriber(t,e,r);if(n?o.add(n.call(o,this.source)):o.add(this.source||config.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),config.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){config.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),canReportError(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=getPromiseCtor(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[observable]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:pipeFromArray(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=getPromiseCtor(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function getPromiseCtor(t){if(t||(t=Promise),!t)throw new Error("no Promise impl found");return t}function tnLineStdinReader(){return new Observable((function(t){var e=readline.createInterface(process.stdin),r=null,n=null;e.on("line",(function(o){null===r?r=+o:null===n?(n=+o,r--):(n=null,t.next(o),0===r&&(e.close(),t.complete()))}))}))}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e){return t(e={exports:{}},e.exports),e.exports}var check=function(t){return t&&t.Math==Math&&t},global_1=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof commonjsGlobal&&commonjsGlobal)||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},descriptors=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),nativePropertyIsEnumerable={}.propertyIsEnumerable,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor&&!nativePropertyIsEnumerable.call({1:2},1),f=NASHORN_BUG?function(t){var e=getOwnPropertyDescriptor(this,t);return!!e&&e.enumerable}:nativePropertyIsEnumerable,objectPropertyIsEnumerable={f:f},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},toString={}.toString,classofRaw=function(t){return toString.call(t).slice(8,-1)},split="".split,indexedObject=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?split.call(t,""):Object(t)}:Object,requireObjectCoercible=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},toIndexedObject=function(t){return indexedObject(requireObjectCoercible(t))},isObject$1=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject$1(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!isObject$1(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!isObject$1(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!isObject$1(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},hasOwnProperty={}.hasOwnProperty,has=function(t,e){return hasOwnProperty.call(t,e)},document$1=global_1.document,EXISTS=isObject$1(document$1)&&isObject$1(document$1.createElement),documentCreateElement=function(t){return EXISTS?document$1.createElement(t):{}},ie8DomDefine=!descriptors&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),nativeGetOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,f$1=descriptors?nativeGetOwnPropertyDescriptor:function(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),ie8DomDefine)try{return nativeGetOwnPropertyDescriptor(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(t,e),t[e])},objectGetOwnPropertyDescriptor={f:f$1},anObject=function(t){if(!isObject$1(t))throw TypeError(String(t)+" is not an object");return t},nativeDefineProperty=Object.defineProperty,f$2=descriptors?nativeDefineProperty:function(t,e,r){if(anObject(t),e=toPrimitive(e,!0),anObject(r),ie8DomDefine)try{return nativeDefineProperty(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t},objectDefineProperty={f:f$2},createNonEnumerableProperty=descriptors?function(t,e,r){return objectDefineProperty.f(t,e,createPropertyDescriptor(1,r))}:function(t,e,r){return t[e]=r,t},setGlobal=function(t,e){try{createNonEnumerableProperty(global_1,t,e)}catch(r){global_1[t]=e}return e},SHARED="__core-js_shared__",store=global_1[SHARED]||setGlobal(SHARED,{}),sharedStore=store,functionToString=Function.toString;"function"!=typeof sharedStore.inspectSource&&(sharedStore.inspectSource=function(t){return functionToString.call(t)});var set,get,has$1,inspectSource=sharedStore.inspectSource,WeakMap=global_1.WeakMap,nativeWeakMap="function"==typeof WeakMap&&/native code/.test(inspectSource(WeakMap)),isPure=!1,shared=createCommonjsModule((function(t){(t.exports=function(t,e){return sharedStore[t]||(sharedStore[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.2",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),id=0,postfix=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++id+postfix).toString(36)},keys=shared("keys"),sharedKey=function(t){return keys[t]||(keys[t]=uid(t))},hiddenKeys={},WeakMap$1=global_1.WeakMap,enforce=function(t){return has$1(t)?get(t):set(t,{})},getterFor=function(t){return function(e){var r;if(!isObject$1(e)||(r=get(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}};if(nativeWeakMap){var store$1=new WeakMap$1,wmget=store$1.get,wmhas=store$1.has,wmset=store$1.set;set=function(t,e){return wmset.call(store$1,t,e),e},get=function(t){return wmget.call(store$1,t)||{}},has$1=function(t){return wmhas.call(store$1,t)}}else{var STATE=sharedKey("state");hiddenKeys[STATE]=!0,set=function(t,e){return createNonEnumerableProperty(t,STATE,e),e},get=function(t){return has(t,STATE)?t[STATE]:{}},has$1=function(t){return has(t,STATE)}}var internalState={set:set,get:get,has:has$1,enforce:enforce,getterFor:getterFor},redefine=createCommonjsModule((function(t){var e=internalState.get,r=internalState.enforce,n=String(String).split("String");(t.exports=function(t,e,o,i){var c=!!i&&!!i.unsafe,a=!!i&&!!i.enumerable,s=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof e||has(o,"name")||createNonEnumerableProperty(o,"name",e),r(o).source=n.join("string"==typeof e?e:"")),t!==global_1?(c?!s&&t[e]&&(a=!0):delete t[e],a?t[e]=o:createNonEnumerableProperty(t,e,o)):a?t[e]=o:setGlobal(e,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||inspectSource(this)}))})),path=global_1,aFunction=function(t){return"function"==typeof t?t:void 0},getBuiltIn=function(t,e){return arguments.length<2?aFunction(path[t])||aFunction(global_1[t]):path[t]&&path[t][e]||global_1[t]&&global_1[t][e]},ceil=Math.ceil,floor=Math.floor,toInteger=function(t){return isNaN(t=+t)?0:(t>0?floor:ceil)(t)},min=Math.min,toLength=function(t){return t>0?min(toInteger(t),9007199254740991):0},max=Math.max,min$1=Math.min,toAbsoluteIndex=function(t,e){var r=toInteger(t);return r<0?max(r+e,0):min$1(r,e)},createMethod=function(t){return function(e,r,n){var o,i=toIndexedObject(e),c=toLength(i.length),a=toAbsoluteIndex(n,c);if(t&&r!=r){for(;c>a;)if((o=i[a++])!=o)return!0}else for(;c>a;a++)if((t||a in i)&&i[a]===r)return t||a||0;return!t&&-1}},arrayIncludes={includes:createMethod(!0),indexOf:createMethod(!1)},indexOf=arrayIncludes.indexOf,objectKeysInternal=function(t,e){var r,n=toIndexedObject(t),o=0,i=[];for(r in n)!has(hiddenKeys,r)&&has(n,r)&&i.push(r);for(;e.length>o;)has(n,r=e[o++])&&(~indexOf(i,r)||i.push(r));return i},enumBugKeys=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],hiddenKeys$1=enumBugKeys.concat("length","prototype"),f$3=Object.getOwnPropertyNames||function(t){return objectKeysInternal(t,hiddenKeys$1)},objectGetOwnPropertyNames={f:f$3},f$4=Object.getOwnPropertySymbols,objectGetOwnPropertySymbols={f:f$4},ownKeys=getBuiltIn("Reflect","ownKeys")||function(t){var e=objectGetOwnPropertyNames.f(anObject(t)),r=objectGetOwnPropertySymbols.f;return r?e.concat(r(t)):e},copyConstructorProperties=function(t,e){for(var r=ownKeys(e),n=objectDefineProperty.f,o=objectGetOwnPropertyDescriptor.f,i=0;i<r.length;i++){var c=r[i];has(t,c)||n(t,c,o(e,c))}},replacement=/#|\.prototype\./,isForced=function(t,e){var r=data[normalize(t)];return r==POLYFILL||r!=NATIVE&&("function"==typeof e?fails(e):!!e)},normalize=isForced.normalize=function(t){return String(t).replace(replacement,".").toLowerCase()},data=isForced.data={},NATIVE=isForced.NATIVE="N",POLYFILL=isForced.POLYFILL="P",isForced_1=isForced,getOwnPropertyDescriptor$1=objectGetOwnPropertyDescriptor.f,_export=function(t,e){var r,n,o,i,c,a=t.target,s=t.global,u=t.stat;if(r=s?global_1:u?global_1[a]||setGlobal(a,{}):(global_1[a]||{}).prototype)for(n in e){if(i=e[n],o=t.noTargetGet?(c=getOwnPropertyDescriptor$1(r,n))&&c.value:r[n],!isForced_1(s?n:a+(u?".":"#")+n,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;copyConstructorProperties(i,o)}(t.sham||o&&o.sham)&&createNonEnumerableProperty(i,"sham",!0),redefine(r,n,i,t)}},regexpFlags=function(){var t=anObject(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e};function RE(t,e){return RegExp(t,e)}var UNSUPPORTED_Y=fails((function(){var t=RE("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),BROKEN_CARET=fails((function(){var t=RE("^r","gy");return t.lastIndex=2,null!=t.exec("str")})),regexpStickyHelpers={UNSUPPORTED_Y:UNSUPPORTED_Y,BROKEN_CARET:BROKEN_CARET},nativeExec=RegExp.prototype.exec,nativeReplace=String.prototype.replace,patchedExec=nativeExec,UPDATES_LAST_INDEX_WRONG=function(){var t=/a/,e=/b*/g;return nativeExec.call(t,"a"),nativeExec.call(e,"a"),0!==t.lastIndex||0!==e.lastIndex}(),UNSUPPORTED_Y$1=regexpStickyHelpers.UNSUPPORTED_Y||regexpStickyHelpers.BROKEN_CARET,NPCG_INCLUDED=void 0!==/()??/.exec("")[1],PATCH=UPDATES_LAST_INDEX_WRONG||NPCG_INCLUDED||UNSUPPORTED_Y$1;PATCH&&(patchedExec=function(t){var e,r,n,o,i=this,c=UNSUPPORTED_Y$1&&i.sticky,a=regexpFlags.call(i),s=i.source,u=0,l=t;return c&&(-1===(a=a.replace("y","")).indexOf("g")&&(a+="g"),l=String(t).slice(i.lastIndex),i.lastIndex>0&&(!i.multiline||i.multiline&&"\n"!==t[i.lastIndex-1])&&(s="(?: "+s+")",l=" "+l,u++),r=new RegExp("^(?:"+s+")",a)),NPCG_INCLUDED&&(r=new RegExp("^"+s+"$(?!\\s)",a)),UPDATES_LAST_INDEX_WRONG&&(e=i.lastIndex),n=nativeExec.call(c?r:i,l),c?n?(n.input=n.input.slice(u),n[0]=n[0].slice(u),n.index=i.lastIndex,i.lastIndex+=n[0].length):i.lastIndex=0:UPDATES_LAST_INDEX_WRONG&&n&&(i.lastIndex=i.global?n.index+n[0].length:e),NPCG_INCLUDED&&n&&n.length>1&&nativeReplace.call(n[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n});var regexpExec=patchedExec;_export({target:"RegExp",proto:!0,forced:/./.exec!==regexpExec},{exec:regexpExec});var fromCharCode=String.fromCharCode,nativeFromCodePoint=String.fromCodePoint,INCORRECT_LENGTH=!!nativeFromCodePoint&&1!=nativeFromCodePoint.length;_export({target:"String",stat:!0,forced:INCORRECT_LENGTH},{fromCodePoint:function(t){for(var e,r=[],n=arguments.length,o=0;n>o;){if(e=+arguments[o++],toAbsoluteIndex(e,1114111)!==e)throw RangeError(e+" is not a valid code point");r.push(e<65536?fromCharCode(e):fromCharCode(55296+((e-=65536)>>10),e%1024+56320))}return r.join("")}}),_export({target:"String",stat:!0},{raw:function(t){for(var e=toIndexedObject(t.raw),r=toLength(e.length),n=arguments.length,o=[],i=0;r>i;)o.push(String(e[i++])),i<n&&o.push(String(arguments[i]));return o.join("")}});var createMethod$1=function(t){return function(e,r){var n,o,i=String(requireObjectCoercible(e)),c=toInteger(r),a=i.length;return c<0||c>=a?t?"":void 0:(n=i.charCodeAt(c))<55296||n>56319||c+1===a||(o=i.charCodeAt(c+1))<56320||o>57343?t?i.charAt(c):n:t?i.slice(c,c+2):o-56320+(n-55296<<10)+65536}},stringMultibyte={codeAt:createMethod$1(!1),charAt:createMethod$1(!0)},codeAt=stringMultibyte.codeAt;_export({target:"String",proto:!0},{codePointAt:function(t){return codeAt(this,t)}});var nativeSymbol=!!Object.getOwnPropertySymbols&&!fails((function(){return!String(Symbol())})),useSymbolAsUid=nativeSymbol&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,WellKnownSymbolsStore=shared("wks"),Symbol$1=global_1.Symbol,createWellKnownSymbol=useSymbolAsUid?Symbol$1:Symbol$1&&Symbol$1.withoutSetter||uid,wellKnownSymbol=function(t){return has(WellKnownSymbolsStore,t)||(nativeSymbol&&has(Symbol$1,t)?WellKnownSymbolsStore[t]=Symbol$1[t]:WellKnownSymbolsStore[t]=createWellKnownSymbol("Symbol."+t)),WellKnownSymbolsStore[t]},MATCH=wellKnownSymbol("match"),isRegexp=function(t){var e;return isObject$1(t)&&(void 0!==(e=t[MATCH])?!!e:"RegExp"==classofRaw(t))},notARegexp=function(t){if(isRegexp(t))throw TypeError("The method doesn't accept regular expressions");return t},MATCH$1=wellKnownSymbol("match"),correctIsRegexpLogic=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[MATCH$1]=!1,"/./"[t](e)}catch(t){}}return!1},getOwnPropertyDescriptor$2=objectGetOwnPropertyDescriptor.f,nativeEndsWith="".endsWith,min$2=Math.min,CORRECT_IS_REGEXP_LOGIC=correctIsRegexpLogic("endsWith"),MDN_POLYFILL_BUG=!CORRECT_IS_REGEXP_LOGIC&&!!function(){var t=getOwnPropertyDescriptor$2(String.prototype,"endsWith");return t&&!t.writable}();_export({target:"String",proto:!0,forced:!MDN_POLYFILL_BUG&&!CORRECT_IS_REGEXP_LOGIC},{endsWith:function(t){var e=String(requireObjectCoercible(this));notARegexp(t);var r=arguments.length>1?arguments[1]:void 0,n=toLength(e.length),o=void 0===r?n:min$2(toLength(r),n),i=String(t);return nativeEndsWith?nativeEndsWith.call(e,i,o):e.slice(o-i.length,o)===i}}),_export({target:"String",proto:!0,forced:!correctIsRegexpLogic("includes")},{includes:function(t){return!!~String(requireObjectCoercible(this)).indexOf(notARegexp(t),arguments.length>1?arguments[1]:void 0)}});var SPECIES=wellKnownSymbol("species"),REPLACE_SUPPORTS_NAMED_GROUPS=!fails((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),REPLACE_KEEPS_$0="$0"==="a".replace(/./,"$0"),SPLIT_WORKS_WITH_OVERWRITTEN_EXEC=!fails((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var r="ab".split(t);return 2!==r.length||"a"!==r[0]||"b"!==r[1]})),fixRegexpWellKnownSymbolLogic=function(t,e,r,n){var o=wellKnownSymbol(t),i=!fails((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),c=i&&!fails((function(){var e=!1,r=/a/;return"split"===t&&((r={}).constructor={},r.constructor[SPECIES]=function(){return r},r.flags="",r[o]=/./[o]),r.exec=function(){return e=!0,null},r[o](""),!e}));if(!i||!c||"replace"===t&&(!REPLACE_SUPPORTS_NAMED_GROUPS||!REPLACE_KEEPS_$0)||"split"===t&&!SPLIT_WORKS_WITH_OVERWRITTEN_EXEC){var a=/./[o],s=r(o,""[t],(function(t,e,r,n,o){return e.exec===regexpExec?i&&!o?{done:!0,value:a.call(e,r,n)}:{done:!0,value:t.call(r,e,n)}:{done:!1}}),{REPLACE_KEEPS_$0:REPLACE_KEEPS_$0}),u=s[0],l=s[1];redefine(String.prototype,t,u),redefine(RegExp.prototype,o,2==e?function(t,e){return l.call(t,this,e)}:function(t){return l.call(t,this)})}n&&createNonEnumerableProperty(RegExp.prototype[o],"sham",!0)},charAt=stringMultibyte.charAt,advanceStringIndex=function(t,e,r){return e+(r?charAt(t,e).length:1)},regexpExecAbstract=function(t,e){var r=t.exec;if("function"==typeof r){var n=r.call(t,e);if("object"!=typeof n)throw TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==classofRaw(t))throw TypeError("RegExp#exec called on incompatible receiver");return regexpExec.call(t,e)};fixRegexpWellKnownSymbolLogic("match",1,(function(t,e,r){return[function(e){var r=requireObjectCoercible(this),n=null==e?void 0:e[t];return void 0!==n?n.call(e,r):new RegExp(e)[t](String(r))},function(t){var n=r(e,t,this);if(n.done)return n.value;var o=anObject(t),i=String(this);if(!o.global)return regexpExecAbstract(o,i);var c=o.unicode;o.lastIndex=0;for(var a,s=[],u=0;null!==(a=regexpExecAbstract(o,i));){var l=String(a[0]);s[u]=l,""===l&&(o.lastIndex=advanceStringIndex(i,toLength(o.lastIndex),c)),u++}return 0===u?null:s}]}));var IteratorPrototype,PrototypeOfArrayIteratorPrototype,arrayIterator,toObject=function(t){return Object(requireObjectCoercible(t))},correctPrototypeGetter=!fails((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),IE_PROTO=sharedKey("IE_PROTO"),ObjectPrototype=Object.prototype,objectGetPrototypeOf=correctPrototypeGetter?Object.getPrototypeOf:function(t){return t=toObject(t),has(t,IE_PROTO)?t[IE_PROTO]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?ObjectPrototype:null},ITERATOR=wellKnownSymbol("iterator"),BUGGY_SAFARI_ITERATORS=!1,returnThis=function(){return this};[].keys&&("next"in(arrayIterator=[].keys())?(PrototypeOfArrayIteratorPrototype=objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator)))!==Object.prototype&&(IteratorPrototype=PrototypeOfArrayIteratorPrototype):BUGGY_SAFARI_ITERATORS=!0),null==IteratorPrototype&&(IteratorPrototype={}),has(IteratorPrototype,ITERATOR)||createNonEnumerableProperty(IteratorPrototype,ITERATOR,returnThis);var activeXDocument,iteratorsCore={IteratorPrototype:IteratorPrototype,BUGGY_SAFARI_ITERATORS:BUGGY_SAFARI_ITERATORS},objectKeys=Object.keys||function(t){return objectKeysInternal(t,enumBugKeys)},objectDefineProperties=descriptors?Object.defineProperties:function(t,e){anObject(t);for(var r,n=objectKeys(e),o=n.length,i=0;o>i;)objectDefineProperty.f(t,r=n[i++],e[r]);return t},html=getBuiltIn("document","documentElement"),GT=">",LT="<",PROTOTYPE="prototype",SCRIPT="script",IE_PROTO$1=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return LT+SCRIPT+GT+t+LT+"/"+SCRIPT+GT},NullProtoObjectViaActiveX=function(t){t.write(scriptTag("")),t.close();var e=t.parentWindow.Object;return t=null,e},NullProtoObjectViaIFrame=function(){var t,e=documentCreateElement("iframe"),r="java"+SCRIPT+":";return e.style.display="none",html.appendChild(e),e.src=String(r),(t=e.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F},NullProtoObject=function(){try{activeXDocument=document.domain&&new ActiveXObject("htmlfile")}catch(t){}NullProtoObject=activeXDocument?NullProtoObjectViaActiveX(activeXDocument):NullProtoObjectViaIFrame();for(var t=enumBugKeys.length;t--;)delete NullProtoObject[PROTOTYPE][enumBugKeys[t]];return NullProtoObject()};hiddenKeys[IE_PROTO$1]=!0;var objectCreate=Object.create||function(t,e){var r;return null!==t?(EmptyConstructor[PROTOTYPE]=anObject(t),r=new EmptyConstructor,EmptyConstructor[PROTOTYPE]=null,r[IE_PROTO$1]=t):r=NullProtoObject(),void 0===e?r:objectDefineProperties(r,e)},defineProperty=objectDefineProperty.f,TO_STRING_TAG=wellKnownSymbol("toStringTag"),setToStringTag=function(t,e,r){t&&!has(t=r?t:t.prototype,TO_STRING_TAG)&&defineProperty(t,TO_STRING_TAG,{configurable:!0,value:e})},IteratorPrototype$1=iteratorsCore.IteratorPrototype,createIteratorConstructor=function(t,e,r){var n=e+" Iterator";return t.prototype=objectCreate(IteratorPrototype$1,{next:createPropertyDescriptor(1,r)}),setToStringTag(t,n,!1),t},aFunction$1=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},SPECIES$1=wellKnownSymbol("species"),speciesConstructor=function(t,e){var r,n=anObject(t).constructor;return void 0===n||null==(r=anObject(n)[SPECIES$1])?e:aFunction$1(r)},MATCH_ALL=wellKnownSymbol("matchAll"),REGEXP_STRING="RegExp String",REGEXP_STRING_ITERATOR=REGEXP_STRING+" Iterator",setInternalState=internalState.set,getInternalState=internalState.getterFor(REGEXP_STRING_ITERATOR),RegExpPrototype=RegExp.prototype,regExpBuiltinExec=RegExpPrototype.exec,nativeMatchAll="".matchAll,WORKS_WITH_NON_GLOBAL_REGEX=!!nativeMatchAll&&!fails((function(){"a".matchAll(/./)})),regExpExec=function(t,e){var r,n=t.exec;if("function"==typeof n){if("object"!=typeof(r=n.call(t,e)))throw TypeError("Incorrect exec result");return r}return regExpBuiltinExec.call(t,e)},$RegExpStringIterator=createIteratorConstructor((function(t,e,r,n){setInternalState(this,{type:REGEXP_STRING_ITERATOR,regexp:t,string:e,global:r,unicode:n,done:!1})}),REGEXP_STRING,(function(){var t=getInternalState(this);if(t.done)return{value:void 0,done:!0};var e=t.regexp,r=t.string,n=regExpExec(e,r);return null===n?{value:void 0,done:t.done=!0}:t.global?(""==String(n[0])&&(e.lastIndex=advanceStringIndex(r,toLength(e.lastIndex),t.unicode)),{value:n,done:!1}):(t.done=!0,{value:n,done:!1})})),$matchAll=function(t){var e,r,n,o,i,c,a=anObject(this),s=String(t);return e=speciesConstructor(a,RegExp),void 0===(r=a.flags)&&a instanceof RegExp&&!("flags"in RegExpPrototype)&&(r=regexpFlags.call(a)),n=void 0===r?"":String(r),o=new e(e===RegExp?a.source:a,n),i=!!~n.indexOf("g"),c=!!~n.indexOf("u"),o.lastIndex=toLength(a.lastIndex),new $RegExpStringIterator(o,s,i,c)};_export({target:"String",proto:!0,forced:WORKS_WITH_NON_GLOBAL_REGEX},{matchAll:function(t){var e,r,n=requireObjectCoercible(this);if(null!=t){if(isRegexp(t)&&!~String(requireObjectCoercible("flags"in RegExpPrototype?t.flags:regexpFlags.call(t))).indexOf("g"))throw TypeError("`.matchAll` does not allow non-global regexes");if(WORKS_WITH_NON_GLOBAL_REGEX)return nativeMatchAll.apply(n,arguments);if(void 0===(r=t[MATCH_ALL])&&isPure&&"RegExp"==classofRaw(t)&&(r=$matchAll),null!=r)return aFunction$1(r).call(t,n)}else if(WORKS_WITH_NON_GLOBAL_REGEX)return nativeMatchAll.apply(n,arguments);return e=String(n),new RegExp(t,"g")[MATCH_ALL](e)}}),MATCH_ALL in RegExpPrototype||createNonEnumerableProperty(RegExpPrototype,MATCH_ALL,$matchAll);var stringRepeat="".repeat||function(t){var e=String(requireObjectCoercible(this)),r="",n=toInteger(t);if(n<0||n==1/0)throw RangeError("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(e+=e))1&n&&(r+=e);return r},ceil$1=Math.ceil,createMethod$2=function(t){return function(e,r,n){var o,i,c=String(requireObjectCoercible(e)),a=c.length,s=void 0===n?" ":String(n),u=toLength(r);return u<=a||""==s?c:(o=u-a,(i=stringRepeat.call(s,ceil$1(o/s.length))).length>o&&(i=i.slice(0,o)),t?c+i:i+c)}},stringPad={start:createMethod$2(!1),end:createMethod$2(!0)},engineUserAgent=getBuiltIn("navigator","userAgent")||"",stringPadWebkitBug=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(engineUserAgent),$padEnd=stringPad.end;_export({target:"String",proto:!0,forced:stringPadWebkitBug},{padEnd:function(t){return $padEnd(this,t,arguments.length>1?arguments[1]:void 0)}});var $padStart=stringPad.start;_export({target:"String",proto:!0,forced:stringPadWebkitBug},{padStart:function(t){return $padStart(this,t,arguments.length>1?arguments[1]:void 0)}}),_export({target:"String",proto:!0},{repeat:stringRepeat});var max$1=Math.max,min$3=Math.min,floor$1=Math.floor,SUBSTITUTION_SYMBOLS=/\$([$&'`]|\d\d?|<[^>]*>)/g,SUBSTITUTION_SYMBOLS_NO_NAMED=/\$([$&'`]|\d\d?)/g,maybeToString=function(t){return void 0===t?t:String(t)};fixRegexpWellKnownSymbolLogic("replace",2,(function(t,e,r,n){return[function(r,n){var o=requireObjectCoercible(this),i=null==r?void 0:r[t];return void 0!==i?i.call(r,o,n):e.call(String(o),r,n)},function(t,i){if(n.REPLACE_KEEPS_$0||"string"==typeof i&&-1===i.indexOf("$0")){var c=r(e,t,this,i);if(c.done)return c.value}var a=anObject(t),s=String(this),u="function"==typeof i;u||(i=String(i));var l=a.global;if(l){var p=a.unicode;a.lastIndex=0}for(var f=[];;){var g=regexpExecAbstract(a,s);if(null===g)break;if(f.push(g),!l)break;""===String(g[0])&&(a.lastIndex=advanceStringIndex(s,toLength(a.lastIndex),p))}for(var h="",b=0,d=0;d<f.length;d++){g=f[d];for(var y=String(g[0]),S=max$1(min$3(toInteger(g.index),s.length),0),E=[],_=1;_<g.length;_++)E.push(maybeToString(g[_]));var m=g.groups;if(u){var O=[y].concat(E,S,s);void 0!==m&&O.push(m);var v=String(i.apply(void 0,O))}else v=o(y,s,S,E,m,i);S>=b&&(h+=s.slice(b,S)+v,b=S+y.length)}return h+s.slice(b)}];function o(t,r,n,o,i,c){var a=n+t.length,s=o.length,u=SUBSTITUTION_SYMBOLS_NO_NAMED;return void 0!==i&&(i=toObject(i),u=SUBSTITUTION_SYMBOLS),e.call(c,u,(function(e,c){var u;switch(c.charAt(0)){case"$":return"$";case"&":return t;case"`":return r.slice(0,n);case"'":return r.slice(a);case"<":u=i[c.slice(1,-1)];break;default:var l=+c;if(0===l)return e;if(l>s){var p=floor$1(l/10);return 0===p?e:p<=s?void 0===o[p-1]?c.charAt(1):o[p-1]+c.charAt(1):e}u=o[l-1]}return void 0===u?"":u}))}}));var sameValue=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};fixRegexpWellKnownSymbolLogic("search",1,(function(t,e,r){return[function(e){var r=requireObjectCoercible(this),n=null==e?void 0:e[t];return void 0!==n?n.call(e,r):new RegExp(e)[t](String(r))},function(t){var n=r(e,t,this);if(n.done)return n.value;var o=anObject(t),i=String(this),c=o.lastIndex;sameValue(c,0)||(o.lastIndex=0);var a=regexpExecAbstract(o,i);return sameValue(o.lastIndex,c)||(o.lastIndex=c),null===a?-1:a.index}]}));var arrayPush=[].push,min$4=Math.min,MAX_UINT32=4294967295,SUPPORTS_Y=!fails((function(){return!RegExp(MAX_UINT32,"y")}));fixRegexpWellKnownSymbolLogic("split",2,(function(t,e,r){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,r){var n=String(requireObjectCoercible(this)),o=void 0===r?MAX_UINT32:r>>>0;if(0===o)return[];if(void 0===t)return[n];if(!isRegexp(t))return e.call(n,t,o);for(var i,c,a,s=[],u=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),l=0,p=new RegExp(t.source,u+"g");(i=regexpExec.call(p,n))&&!((c=p.lastIndex)>l&&(s.push(n.slice(l,i.index)),i.length>1&&i.index<n.length&&arrayPush.apply(s,i.slice(1)),a=i[0].length,l=c,s.length>=o));)p.lastIndex===i.index&&p.lastIndex++;return l===n.length?!a&&p.test("")||s.push(""):s.push(n.slice(l)),s.length>o?s.slice(0,o):s}:"0".split(void 0,0).length?function(t,r){return void 0===t&&0===r?[]:e.call(this,t,r)}:e,[function(e,r){var o=requireObjectCoercible(this),i=null==e?void 0:e[t];return void 0!==i?i.call(e,o,r):n.call(String(o),e,r)},function(t,o){var i=r(n,t,this,o,n!==e);if(i.done)return i.value;var c=anObject(t),a=String(this),s=speciesConstructor(c,RegExp),u=c.unicode,l=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(SUPPORTS_Y?"y":"g"),p=new s(SUPPORTS_Y?c:"^(?:"+c.source+")",l),f=void 0===o?MAX_UINT32:o>>>0;if(0===f)return[];if(0===a.length)return null===regexpExecAbstract(p,a)?[a]:[];for(var g=0,h=0,b=[];h<a.length;){p.lastIndex=SUPPORTS_Y?h:0;var d,y=regexpExecAbstract(p,SUPPORTS_Y?a:a.slice(h));if(null===y||(d=min$4(toLength(p.lastIndex+(SUPPORTS_Y?0:h)),a.length))===g)h=advanceStringIndex(a,h,u);else{if(b.push(a.slice(g,h)),b.length===f)return b;for(var S=1;S<=y.length-1;S++)if(b.push(y[S]),b.length===f)return b;h=g=d}}return b.push(a.slice(g)),b}]}),!SUPPORTS_Y);var getOwnPropertyDescriptor$3=objectGetOwnPropertyDescriptor.f,nativeStartsWith="".startsWith,min$5=Math.min,CORRECT_IS_REGEXP_LOGIC$1=correctIsRegexpLogic("startsWith"),MDN_POLYFILL_BUG$1=!CORRECT_IS_REGEXP_LOGIC$1&&!!function(){var t=getOwnPropertyDescriptor$3(String.prototype,"startsWith");return t&&!t.writable}();_export({target:"String",proto:!0,forced:!MDN_POLYFILL_BUG$1&&!CORRECT_IS_REGEXP_LOGIC$1},{startsWith:function(t){var e=String(requireObjectCoercible(this));notARegexp(t);var r=toLength(min$5(arguments.length>1?arguments[1]:void 0,e.length)),n=String(t);return nativeStartsWith?nativeStartsWith.call(e,n,r):e.slice(r,r+n.length)===n}});var whitespaces="\t\n\v\f\r                　\u2028\u2029\ufeff",whitespace="["+whitespaces+"]",ltrim=RegExp("^"+whitespace+whitespace+"*"),rtrim=RegExp(whitespace+whitespace+"*$"),createMethod$3=function(t){return function(e){var r=String(requireObjectCoercible(e));return 1&t&&(r=r.replace(ltrim,"")),2&t&&(r=r.replace(rtrim,"")),r}},stringTrim={start:createMethod$3(1),end:createMethod$3(2),trim:createMethod$3(3)},non="",stringTrimForced=function(t){return fails((function(){return!!whitespaces[t]()||non[t]()!=non||whitespaces[t].name!==t}))},$trim=stringTrim.trim;_export({target:"String",proto:!0,forced:stringTrimForced("trim")},{trim:function(){return $trim(this)}});var $trimStart=stringTrim.start,FORCED=stringTrimForced("trimStart"),trimStart=FORCED?function(){return $trimStart(this)}:"".trimStart;_export({target:"String",proto:!0,forced:FORCED},{trimStart:trimStart,trimLeft:trimStart});var $trimEnd=stringTrim.end,FORCED$1=stringTrimForced("trimEnd"),trimEnd=FORCED$1?function(){return $trimEnd(this)}:"".trimEnd;_export({target:"String",proto:!0,forced:FORCED$1},{trimEnd:trimEnd,trimRight:trimEnd});var aPossiblePrototype=function(t){if(!isObject$1(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t},objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(r,[]),e=r instanceof Array}catch(t){}return function(r,n){return anObject(r),aPossiblePrototype(n),e?t.call(r,n):r.__proto__=n,r}}():void 0),IteratorPrototype$2=iteratorsCore.IteratorPrototype,BUGGY_SAFARI_ITERATORS$1=iteratorsCore.BUGGY_SAFARI_ITERATORS,ITERATOR$1=wellKnownSymbol("iterator"),KEYS="keys",VALUES="values",ENTRIES="entries",returnThis$1=function(){return this},defineIterator=function(t,e,r,n,o,i,c){createIteratorConstructor(r,e,n);var a,s,u,l=function(t){if(t===o&&b)return b;if(!BUGGY_SAFARI_ITERATORS$1&&t in g)return g[t];switch(t){case KEYS:case VALUES:case ENTRIES:return function(){return new r(this,t)}}return function(){return new r(this)}},p=e+" Iterator",f=!1,g=t.prototype,h=g[ITERATOR$1]||g["@@iterator"]||o&&g[o],b=!BUGGY_SAFARI_ITERATORS$1&&h||l(o),d="Array"==e&&g.entries||h;if(d&&(a=objectGetPrototypeOf(d.call(new t)),IteratorPrototype$2!==Object.prototype&&a.next&&(objectGetPrototypeOf(a)!==IteratorPrototype$2&&(objectSetPrototypeOf?objectSetPrototypeOf(a,IteratorPrototype$2):"function"!=typeof a[ITERATOR$1]&&createNonEnumerableProperty(a,ITERATOR$1,returnThis$1)),setToStringTag(a,p,!0))),o==VALUES&&h&&h.name!==VALUES&&(f=!0,b=function(){return h.call(this)}),g[ITERATOR$1]!==b&&createNonEnumerableProperty(g,ITERATOR$1,b),o)if(s={values:l(VALUES),keys:i?b:l(KEYS),entries:l(ENTRIES)},c)for(u in s)!BUGGY_SAFARI_ITERATORS$1&&!f&&u in g||redefine(g,u,s[u]);else _export({target:e,proto:!0,forced:BUGGY_SAFARI_ITERATORS$1||f},s);return s},charAt$1=stringMultibyte.charAt,STRING_ITERATOR="String Iterator",setInternalState$1=internalState.set,getInternalState$1=internalState.getterFor(STRING_ITERATOR);defineIterator(String,"String",(function(t){setInternalState$1(this,{type:STRING_ITERATOR,string:String(t),index:0})}),(function(){var t,e=getInternalState$1(this),r=e.string,n=e.index;return n>=r.length?{value:void 0,done:!0}:(t=charAt$1(r,n),e.index+=t.length,{value:t,done:!1})}));var quot=/"/g,createHtml=function(t,e,r,n){var o=String(requireObjectCoercible(t)),i="<"+e;return""!==r&&(i+=" "+r+'="'+String(n).replace(quot,""")+'"'),i+">"+o+"</"+e+">"},stringHtmlForced=function(t){return fails((function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3}))};_export({target:"String",proto:!0,forced:stringHtmlForced("anchor")},{anchor:function(t){return createHtml(this,"a","name",t)}}),_export({target:"String",proto:!0,forced:stringHtmlForced("big")},{big:function(){return createHtml(this,"big","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("blink")},{blink:function(){return createHtml(this,"blink","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("bold")},{bold:function(){return createHtml(this,"b","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("fixed")},{fixed:function(){return createHtml(this,"tt","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("fontcolor")},{fontcolor:function(t){return createHtml(this,"font","color",t)}}),_export({target:"String",proto:!0,forced:stringHtmlForced("fontsize")},{fontsize:function(t){return createHtml(this,"font","size",t)}}),_export({target:"String",proto:!0,forced:stringHtmlForced("italics")},{italics:function(){return createHtml(this,"i","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("link")},{link:function(t){return createHtml(this,"a","href",t)}}),_export({target:"String",proto:!0,forced:stringHtmlForced("small")},{small:function(){return createHtml(this,"small","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("strike")},{strike:function(){return createHtml(this,"strike","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("sub")},{sub:function(){return createHtml(this,"sub","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("sup")},{sup:function(){return createHtml(this,"sup","","")}});var string=path.String,charAt$2=stringMultibyte.charAt;_export({target:"String",proto:!0},{at:function(t){return charAt$2(this,t)}});var codeAt$1=stringMultibyte.codeAt,charAt$3=stringMultibyte.charAt,STRING_ITERATOR$1="String Iterator",setInternalState$2=internalState.set,getInternalState$2=internalState.getterFor(STRING_ITERATOR$1),$StringIterator=createIteratorConstructor((function(t){setInternalState$2(this,{type:STRING_ITERATOR$1,string:t,index:0})}),"String",(function(){var t,e=getInternalState$2(this),r=e.string,n=e.index;return n>=r.length?{value:void 0,done:!0}:(t=charAt$3(r,n),e.index+=t.length,{value:{codePoint:codeAt$1(t,0),position:n},done:!1})}));_export({target:"String",proto:!0},{codePoints:function(){return new $StringIterator(String(requireObjectCoercible(this)))}});var REPLACE=wellKnownSymbol("replace"),RegExpPrototype$1=RegExp.prototype;_export({target:"String",proto:!0},{replaceAll:function t(e,r){var n,o,i,c,a,s,u,l=requireObjectCoercible(this);if(null!=e){if(isRegexp(e)&&!~String(requireObjectCoercible("flags"in RegExpPrototype$1?e.flags:regexpFlags.call(e))).indexOf("g"))throw TypeError("`.replaceAll` does not allow non-global regexes");if(void 0!==(n=e[REPLACE]))return n.call(e,l,r)}if(o=String(l),""===(i=String(e)))return t.call(o,/(?:)/g,r);if(c=o.split(i),"function"!=typeof r)return c.join(String(r));for(s=(a=c[0]).length,u=1;u<c.length;u++)a+=String(r(i,s,o)),s+=i.length+c[u].length,a+=c[u];return a}}),tnLineStdinReader().subscribe((function(t){var e=_toConsumableArray(t.matchAll(/AP+/g)).map((function(t){return t[0].length-1})).sort((function(t,e){return e-t})),r=e.length?e[0]:0;console.log(r)}));

    var t;
    t=readline();
    while (t--){
        var ans=0; var c=0,str,n;
        n=readline();
        str=readline();
        for (var i=n-1; i>-1; i--){
             if (str[i]=='P')
             c++;
             else {if (c>ans)
             ans=c;
             c=0;
             }
            }
            print (ans);
        }

var queries = parseInt(readline());
for(var i = 0; i< queries;i++){
var discard = readline();
var myString = readline();
var val = myString.split(/[A]/);
while (val[val.length-1] == ""){
  val.pop();
}
if (val[0] == ""){
while (val[0] == ""){
  val.shift();
}
}
else{
  val.shift();
}
var result = val.reduce((sum,ele)=>{
  if (ele.length > sum){
    return sum += ele.length - sum;
  }
  else{
    return sum;
  }
},0)
print(result);
}

var t = readline();
for(var n=0;n<t;n++){
    var k = readline();
    var s = readline();
    print(result(s));
}

function result(s){
    if(s===undefined){s="";}
    var arr=s.split("");
    var arr2=s.split("");
    var noChange=false;
    var time=-1;
    while(!noChange){
        noChange=true;
        for(var i=0;i<arr.length-1;i++){
            if(arr[i]==='A'&&arr[i+1]!=='A'){arr2[i+1]='A';noChange=false;}
        }
        time++;
        arr=arr2.slice();
    }//break while once no Changes
    return time;
}//result method

function myout(t){print(t);}//standard output
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main() {
  var t = myconv(readline(),1);
  var output = [];
  for(var i = 0; i < t; i++){
      var k = myconv(readline(),1);
      var list = myconv(readline(),6);
      var isA = false;
      var countP = 0;
      var maxP = 0;
      for(var j = 0; j < k; j++){
          if(!isA && list[j] == "P"){
              continue;
          }
          if(list[j] == "A"){
              isA = true;
              maxP = Math.max(maxP, countP);
              countP = 0;
          }else if(list[j] == "P"){
              countP++;
          }
      }
      maxP = Math.max(maxP, countP);
      output.push(maxP);
  }
  myout(output.join("\n"));
}

Main();

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var length = +readline();
    var str = readline();

    var ap = str
        .match(/AP+/g)

    if (ap) {
        print(
            ap.map(function(a) {
                return a.length
            })
            .sort(function(a, b) {
                return b - a
            })[0] - 1
        )
    } else {
        print(0)
    }
  }
}
main()

  var t = readline();
  while(t--){
    var n = readline();
    var str = readline();

    var result = 0,
      cnt = 0,
      sum = 0;

    for (var i = 0; i < n; i++) {
      if (str[i] === 'A') {
        cnt = 0;
        sum = 1;
      } else if (sum) {
        cnt++;
      }
      result = Math.max(result, cnt);
    }
    print(result);
  }

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let T = -1;
let num = -1;
rl.on('line', (line) => {
  if (T !== -1 && T % 2) {
    var posA = line.lastIndexOf('A');
    var posP = line.lastIndexOf('P');
    if (posA === num - 1) {
      console.log(0);
    } else if (posP > posA) {
      console.log(posP-posA);
    }
  } else if (T !== -1) {
    num = line;
  }
  T ++;
})

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let T = -1;
let num = -1;
rl.on('line', (line) => {
  if (T !== -1 && T % 2) {
    var posA = line.lastIndexOf('A');
    var posP = line.lastIndexOf('P');
    if (posA === num - 1 || posA === -1) {
      console.log(0);
    } else if (posP > posA) {
      console.log(posP-posA);
    }
  } else if (T !== -1) {
    num = line;
  }
  T ++;
})

'use strict';

var readline = require('readline');

function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}

function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];

    return arr2;
  }
}

function _iterableToArray(iter) {
  if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance");
}

function tnLineStdinReader() {
  return new Promise(function (resolve) {
    var stdin = readline.createInterface(process.stdin);
    var output = [];
    var tests = null;
    var n = null;
    stdin.on('line', function (line) {
      if (tests === null) {
        tests = +line;
      } else if (n === null) {
        n = +line;
        tests--;
      } else if (tests > 0) {
        n = null;
        output.push(line);
      } else {
        output.push(line);
        stdin.close();
        resolve(output);
      }
    });
  });
}

tnLineStdinReader().then(function (tests) {
  tests.forEach(function (t) {
    var allGroups = _toConsumableArray(t.matchAll(/AP+/g)).map(function (match) {
      return match[0].length - 1;
    }).sort(function (a, b) {
      return b - a;
    });

    var maxLength = allGroups.length ? allGroups[0] : 0;
    console.log(maxLength);
  });
});

var queries = parseInt(readline());
for(var i = 0; i < queries ;i++){
var discard = readline();
var myStr = readline();
var result = myStr.split('').reduce((sum,val,index,arr)=>{
    if (arr[index-1] == 'A' && arr[index] == 'P'){
      return sum += 1;
    }
  else{
    return sum;
  }
},0);
print(result);
}

var t;
t=readline();
while (t--){
    var ans=0; var pos=-1,str,n;
    n=readline();
    str=readline();
    for (var i=0; i<n; i++){
        if (str[i]=='P'){
            if (pos!=-1)
                ans=Math.max (ans, i-pos);
            else
            pos=i;
        }
    }
     print (ans);
}


You are given $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$. Find the maximum value of $$$max(a_l, a_{l + 1}, \ldots, a_r) \cdot min(a_l, a_{l + 1}, \ldots, a_r)$$$ over all pairs $$$(l, r)$$$ of integers for which $$$1 \le l < r \le n$$$.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10\,000$$$)  — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^6$$$). It is guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$3 \cdot 10^5$$$.

For each test case, print a single integer  — the maximum possible value of the product from the statement.

var fs = require("fs");
var stdinBuffer = fs.readFileSync(0); // STDIN_FILENO = 0

const lines = stdinBuffer.toString().match(/[^\r\n]+/g).slice(1);

const examples = [];

for(let i = 0; i < lines.length; i+=2) {
    examples.push(lines[i+1].split(' ').map(x => parseInt(x, 10)));
}

const solver = (arr) => {
    let currentMaxResult = 0;

    for (let l = 0; l < arr.length - 1; l++) {
        const result = Math.max(arr[l], arr[l+1]) * Math.min(arr[l], arr[l+1])
        if (result > currentMaxResult) {
            currentMaxResult = result;
        }
    }
    // for(let l = 0; l < arr.length; l++) {
    //     let max = arr[l];
    //     let min = arr[l];
    //     for(let r = l + 1; r < arr.length; r++) {

    //         if (arr[r] > max)
    //         max = Math.max(arr[r], max);
    //         min = Math.min(arr[r], min);
    //         const result = min*max;
    //         if (result > currentMaxResult) {
    //             currentMaxResult = result;
    //             // console.log({subArr})
    //         }
    //     }
    // }

    return currentMaxResult;
};

for(let example of examples) {
    console.log(solver(example))
}

const readline = require('readline')

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

function solve(n, arr) {
    let max = -1
    arr.forEach((x, i) => {
        if (i + 1 < n) {
            max = Math.max(max, x * arr[i + 1])
        }
        if (i - 1 >= 0) {
            max = Math.max(max, x * arr[i - 1])
        }
    })
    return max
}

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
	var t = lines[0];
	var e = 0;
    for(i = 1; i <= t * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ');
            var b = k[0];
            var max = 0;
            for(j = 1; j < e; j++){
                var a = b * k[j];
                if(a > max){
                    max = a;
                }
                b = k[j];
            }
            console.log(max);
        }
    }
});

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

const fs = require('fs');

const input = String(fs.readFileSync(0))
  .split('\n')
  .filter(Boolean)
  .map((str) => str.trim());

for (let i = 2; i < input.length; i += 2) {
  const arr = input[i].split(' ').map((s) => parseInt(s));
  console.log(solve(arr));
}

function solve(arr) {
  let max = 0;

  for (let i = 0; i < arr.length - 1; i++) {
    const prod = arr[i] * arr[i + 1];

    if (prod > max) {
      max = prod;
    }
  }

  return max;
}

const readline = require('readline')

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

function solve(n, arr) {
    const max = Math.max(...arr)
    let m2 = -1
    arr.some((x, i) => {
        if (x < max) return false

        if (i + 1 < n) {
            m2 = Math.max(m2, arr[i + 1])
        }
        if (i - 1 >= 0) {
            m2 = Math.max(m2, arr[i - 1])
        }

        // let second = -1
        // let min = Infinity
        // for (let j = i + 1; j < n; j++) {
        //     min = Math.min(min, arr[j])
        //     second = Math.max(min, second)
        //     console.log('sb', arr[j], min, second)
        //     if (second === max) {
        //         m2 = second
        //         return true
        //     }
        // }
        // min = Infinity
        // for (let j = i - 1; j >= 0; j--) {
        //     min = Math.min(min, arr[j])
        //     second = Math.max(min, second)
        //     console.log('sb', arr[j], min, second)
        //     if (second === max) {
        //         m2 = second
        //         return true
        //     }
        // }
        // m2 = Math.max(m2, second)
    })
    return max * m2
}

const readline = require('readline')

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

function solve(n, arr) {
    const max = Math.max(...arr)
    let m2 = -1
    arr.some((x, i) => {
        if (x < max) return false
        let second = -1
        let min = Infinity
        for (let j = i + 1; j < n; j++) {
            min = Math.min(min, arr[j])
            second = Math.max(min, second)
            if (second === max) {
                m2 = second
                return true
            }
        }
        min = Infinity
        for (let j = i - 1; j >= 0; j--) {
            min = Math.min(min, arr[j])
            second = Math.max(min, second)
            if (second === max) {
                m2 = second
                return true
            }
        }
        m2 = Math.max(m2, second)
    })
    return max * m2
}


Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given teams very well. Let's say that team a solved pa problems with total penalty time ta and team b solved pb problems with total penalty time tb. Team a gets a higher place than team b in the end, if it either solved more problems on the contest, or solved the same number of problems but in less total time. In other words, team a gets a higher place than team b in the final results' table if either pa > pb, or pa = pb and ta < tb. It is considered that the teams that solve the same number of problems with the same penalty time share all corresponding places. More formally, let's say there is a group of x teams that solved the same number of problems with the same penalty time. Let's also say that y teams performed better than the teams from this group. In this case all teams from the group share places y + 1, y + 2, ..., y + x. The teams that performed worse than the teams from this group, get their places in the results table starting from the y + x + 1-th place.Your task is to count what number of teams from the given list shared the k-th place.

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces.

In the only line print the sought number of teams that got the k-th place in the final results' table.

NoteThe final results' table for the first sample is:   1-3 places — 4 solved problems, the penalty time equals 10  4 place — 3 solved problems, the penalty time equals 20  5-6 places — 2 solved problems, the penalty time equals 1  7 place — 1 solved problem, the penalty time equals 10 The table shows that the second place is shared by the teams that solved 4 problems with penalty time 10. There are 3 such teams.The final table for the second sample is:  1 place — 5 solved problems, the penalty time equals 3  2-5 places — 3 solved problems, the penalty time equals 1 The table shows that the fourth place is shared by the teams that solved 3 problems with penalty time 1. There are 4 such teams.

var l=readline().split(' ');
var n=+l[0];
var k=+l[1]-1;
var a=[];
for(var i=0;i<n;i++){
	a.push(readline().split(' ').map(function(v){return+v;}));
}
a.sort(function(a,b){
	if(a[0]===b[0]){
		return a[1]-b[1];
	}else{
		return b[0]-a[0];
	}
});
var ans=0;
for(var i=0; i<n; i++){
	if(a[i][0]===a[k][0]&&a[i][1]===a[k][1]){
		ans++;
	}
}
print(ans);

;(function () {

	var n = readline().split(' ');
	var k = +n[1];
	n = +n[0];

	var v = [];
	for (var i = 0; i < n; i++) v.push(readline().split(' ').map(Number).reduce(function (a, b) { return (a + 1) * 100 - b }));
	v = v.sort(function (a, b) { return b - a; });

	var t = v[k - 1];
	print(v.filter(function (e) { return e === t; }).length);

}).call(this);

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

var n = input[0];
var k = input[1];

var teams = [];

for (var i = 0; i < n ; i++) {
	var team = readline().split(' ').map(Number);
	teams[i] = {p: team[0], t: team[1]};
}

teams[n] = {p: 0, t: 51};

var f = function(ti, tj) {
	if (tj.p - ti.p === 0) {
		return ti.t - tj.t;
	} else {
		return tj.p - ti.p;
	}
}

teams.sort(f);

var same_place = 1;
var current_place = 1;
var output = 0;

for (var j = 0; j < n; j++) {

	while (f(teams[j], teams[j + 1]) === 0) {
		same_place += 1;
		current_place += 1;
		j++;
	}

	if (current_place < k) {
		same_place = 1;
		current_place += 1;
	} else {
		output = same_place;
		break;
	}
}

print(output);

var lt = function(a, b) {
    if (a[0] < b[0]) {
        return true;
    }
    if (a[0] == b[0] && a[1] > b[1]) {
        return true;
    }
    return false;
}

var eq = function(a, b) {
    return (a[0] == b[0] && a[1] == b[1]);
}

var lower_bound = function(A, x) {
    var l = 0;
    var r = A.length - 1;

    while (l <= r) {
        var m = Math.floor((l+r) / 2);
        if (lt(x, A[m])) {
            l = m + 1;
        }
        else {
            r = m - 1;
        }
    }
    return l;
}

var upper_bound = function(A, x) {
    var l = 0;
    var r = A.length - 1;

    while (l <= r) {
        var m = Math.floor((l+r) / 2);
        if (lt(x, A[m]) || eq(x, A[m])) {
            l = m + 1;
        }
        else {
            r = m - 1;
        }
    }
    return l;
}

var main = function(n, k) {
    var s = [];
    for (var i = 0; i < n; i++) {
        s.push(readline().split(' ').map(Number));
    }
    s.sort(function(a, b) {
        if (lt(a, b)) {
            return -1;
        }
        if (eq(a, b)) {
            return 0;
        }
        return 1;
    });
    s.reverse();
    print(upper_bound(s, s[k-1]) - lower_bound(s, s[k-1]));
}

main.apply(0, readline().split(' ').map(Number));

var l=readline().split(' ');
var n=+l[0];
var k=+l[1]-1;
var a=[];
for(var i=0;i<n;i++){
	a.push(readline().split(' ').map(function(v){return+v;}));
}
a.sort(function(a,b){
	if(a[0]===b[0]){
		return b[1]-a[1];
	}else{
		return b[0]-a[0];
	}
});
var ans=0;
for(var i=0; i<n; i++){
	if(a[i][0]===a[k][0]&&a[i][1]===a[k][1]){
		ans++;
	}
}
print(ans);

;(function () {

	var n = readline().split(' ');
	var k = +n[1];
	n = +n[0];

	var v = [];
	for (var i = 0; i < n; i++) v.push(readline().split(' ').map(Number).reduce(function (a, b) { return a * 100 + b }));
	v = v.sort(function (a, b) { return b - a; });

	var t = v[k - 1];
	print(v.filter(function (e) { return e === t; }).length);

}).call(this);


Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time units for the lunch break.The Rabbits have a list of n restaurants to lunch in: the i-th restaurant is characterized by two integers fi and ti. Value ti shows the time the Rabbits need to lunch in the i-th restaurant. If time ti exceeds the time k that the coach has given for the lunch break, then the Rabbits' joy from lunching in this restaurant will equal fi - (ti - k). Otherwise, the Rabbits get exactly fi units of joy.Your task is to find the value of the maximum joy the Rabbits can get from the lunch, depending on the restaurant. The Rabbits must choose exactly one restaurant to lunch in. Note that the joy value isn't necessarily a positive value.

The first line contains two space-separated integers — n (1 ≤ n ≤ 104) and k (1 ≤ k ≤ 109) — the number of restaurants in the Rabbits' list and the time the coach has given them to lunch, correspondingly. Each of the next n lines contains two space-separated integers — fi (1 ≤ fi ≤ 109) and ti (1 ≤ ti ≤ 109) — the characteristics of the i-th restaurant.

In a single line print a single integer — the maximum joy value that the Rabbits will get from the lunch.

let inpStr = "";

function calcJoy(maxTime, joyEarned, timeTaken) {
    if (timeTaken > maxTime) return joyEarned - (timeTaken - maxTime);
    else return joyEarned;

}

process.stdin.addListener("data", data => {//For big amts of inp, it is passed in as multiple smaller chunks, so it must be aggregated
    inpStr += data.toString();
});

process.stdin.addListener("end", data => {//Once all data is recieved, do the calculations
    const splitData = inpStr.split(/[\r\n]+/);
    const params = splitData.splice(0, 1)[0].split(" ").map(n => parseInt(n));
    const restaurants = splitData.map(n => n.split(" ").map(n => parseInt(n)));

    let best = -Infinity;
    for (let restaurant of restaurants) {
        const joy = calcJoy(params[1], restaurant[0], restaurant[1]);
        if (joy > best) best = joy;
    }
    console.log(best);
});

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

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

  const [f, t] = d.split(' ').map(Number);

  if (k >= t) {
    joy = Math.max(joy, f);
  }
  else {
    joy = Math.max(joy, f - (t - k));
  }

  c++;
});

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

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

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

  const [f, t] = d.split(' ').map(Number);
  joy = Math.max(joy, f - Math.max(t - k, 0));

  c++;
});

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

var l=readline().split(' ');
var n=+l[0];
var k=+l[1];

var ans=-1e9;

while(n--){
	var l=readline().split(' ').map(function(v){return+v})
	var c=l[1]-k;
	c=c>0?l[0]-c:l[0];
	ans=Math.max(c,ans);
}
print(ans);

var input = readline().split(" "), n = +input[0], k = +input[1];
var max = -Infinity, p;

for(i = 0; i < n; i++){
	input = readline().split(" ").map(Number)
	f = input[0];
	t = input[1];

	p = (t > k) ? (f - t + k) : f;

	max = Math.max(max, p);
}

write(max);

function main(n,k,arr){

    var max = -Infinity;

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

      if(parseInt(arr[i][1]) > k){
        max = Math.max(max,(parseInt(arr[i][0])-parseInt(arr[i][1]-k)))
      }
      else{
        max = Math.max(max,parseInt(arr[i][0]));
       }
    }

    print(max);

}

var nk = readline().split(" ");
for(var i = 0 ; i < nk.length ; i++)nk[i] = parseInt(nk[i]);

var arr = [];
for(var i = 0 ; i < nk[0] ; i++){
  arr[i] = readline().split(" ");
}

main(nk[0],nk[1],arr)

;(function () {

	var n = readline().split(' ');
	var k = +n[1];
	n = +n[0];

	var x = [], f, t;
	for (var i = 0; i < n; i++) {
		f = readline().split(' ').map(Number);
		t = f[1]; f = f[0];

		x.push( t > k ? f -(t-k) : f );
	}

	print( Math.max.apply(null, x) );

}).call(this)

var tok = null;
var index = 0;
function next() {
    while (tok == null || index == tok.length) {
        tok = readline().split(' ');
        index = 0;
    }
    var res = tok[index++];
    return res;
}

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

function sortNumber(a, b) {
    return a - b;
}

function reverse(s) {
    var rS = "";
    for (var i = 0; i < s.length; i++) {
        rS += s.charAt(s.length - 1 - i);
    }
    return rS;
}

function main() {
    var n = nextInt();
    var k = nextInt();
    var f = nextInt();
    var t = nextInt();
    var joy = f;
    if (t > k) {
        joy = f - t + k;
    }
    var max = joy;
    for (var i = 1; i < n; i++) {
        f = nextInt();
        t = nextInt();
        joy = f;
        if (t > k) {
            joy = f - t + k;
        }
        if (joy > max) {
            max = joy;
        }
    }
    print(max);
}

main();

// 276A     Проблемные обеды

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

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

var n = input_line[0];
var k = input_line[1];

var max = - 1000000000;
var arr = [];
var f;

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

    if (arr[1] > k) {
        f = arr[0] - (arr[1] - k);
    } else {
        f = arr[0];
    };

    if (max < f) max = f;
};

print(max);

function calcJoy(maxTime, joyEarned, timeTaken) {
    if (timeTaken > maxTime) return joyEarned - (timeTaken - maxTime);
     else return joyEarned;

}

process.stdin.addListener("data", data => {
    const splitData = data.toString().split(/[\r\n]+/);
    const params = splitData.splice(0, 1)[0].split(" ").map(n => parseInt(n));
    const restaurants = splitData.map(n => n.split(" ").map(n => parseInt(n)));

    let best = -Infinity;
    for (let restaurant of restaurants) {
        const joy = calcJoy(params[1], restaurant[0], restaurant[1]);
        if (joy > best) best = joy;
    }
    console.log(best);
});

var l=readline().split(' ');
var n=+l[0];
var k=+l[1];

var ans=-1e9;
print(ans)

while(n--){
	var l=readline().split(' ').map(function(v){return+v})
	var c=l[1]-k;
	c=c>0?l[0]-c:l[0];
	ans=Math.max(c,ans);
}
print(ans);


Ashish has $$$n$$$ elements arranged in a line. These elements are represented by two integers $$$a_i$$$ — the value of the element and $$$b_i$$$ — the type of the element (there are only two possible types: $$$0$$$ and $$$1$$$). He wants to sort the elements in non-decreasing values of $$$a_i$$$.He can perform the following operation any number of times:  Select any two elements $$$i$$$ and $$$j$$$ such that $$$b_i \ne b_j$$$ and swap them. That is, he can only swap two elements of different types in one move. Tell him if he can sort the elements in non-decreasing values of $$$a_i$$$ after performing any number of operations.

The first line contains one integer $$$t$$$ $$$(1 \le t \le 100)$$$ — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ $$$(1 \le n \le 500)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_i$$$ $$$(1 \le a_i \le 10^5)$$$  — the value of the $$$i$$$-th element. The third line containts $$$n$$$ integers $$$b_i$$$ $$$(b_i \in \{0, 1\})$$$  — the type of the $$$i$$$-th element.

For each test case, print "Yes" or "No" (without quotes) depending on whether it is possible to sort elements in non-decreasing order of their value. You may print each letter in any case (upper or lower).

NoteFor the first case: The elements are already in sorted order.For the second case: Ashish may first swap elements at positions $$$1$$$ and $$$2$$$, then swap elements at positions $$$2$$$ and $$$3$$$.For the third case: The elements are already in sorted order.For the fourth case: No swap operations may be performed as there is no pair of elements $$$i$$$ and $$$j$$$ such that $$$b_i \ne b_j$$$. The elements cannot be sorted.For the fifth case: Ashish may swap elements at positions $$$3$$$ and $$$4$$$, then elements at positions $$$1$$$ and $$$2$$$.

function is_sorted(arr) {
  for (var i = 1; i < arr.length; i++) {
    if (arr[i] < arr[i - 1]) return false;
  }
  return true;
}
var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var n = parseInt(readline());
  var a = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var b = readline()
    .split(" ")
    .map((val) => parseInt(val));
  if (is_sorted(a) || (b.includes(0) && b.includes(1))) print("Yes");
  else print("No");
}

// var lineIdx = 0;
// var readline = () => {
//   var input = ["2", "4", "10 5 20 30", "0 1 0 1", "4", "10 5 20 30", "1 1 1 1"]
//   return input[lineIdx++];
// };
// var print = (str) => {
//   console.log(str);
// };

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

var checksort = (arr) => {
  for(var i = 0; i < arr.length - 1; i++){
    if(arr[i] > arr[i+1]){
      return false;
    }
  }
  return true;
}

var step = () => {
  var size = readline().split(" ").map(function(x) { return parseInt(x); })[0];
  var numbers = readline().split(" ").map(function(x) { return parseInt(x); });
  var types = readline().split(" ").map(function(x) { return parseInt(x); });
  if(checksort(numbers)){
    print("Yes")
  }
  else {
    if(types.every(x => x == 1) || types.every(x => x == 0)){
      print("No")
    }
    else {
      print("Yes")
    }
  }
}

for(var i = 0; i < n; i++){
  step();
}

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

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var n = +readline();
    var els = readNumArray();
    var vals = readNumArray();
    var vals1 = vals.filter((el) => el);
    var nonConst = vals1.length > 0 && vals1.length < n;
    if (nonConst) {
      print("Yes");
      continue;
    }
    var last = 0;
    for (var j = 0; j < n; j++) {
      if (els[j] - last < 0) {
        print("No");
        break;
      }
      last = els[j];

      if (j === n - 1) {
        print("Yes");
      }
    }
  }

}

main();

// const bg = require('big-integer')
process.stdin.resume()
process.stdin.setEncoding('utf-8')
const MOD1 = 1000000007

function alpha(c = 'A') {
  return [...{
    _b: c === 'A' ? 65 : 97,
    _i: -1,
    [Symbol.iterator]() {
      return this
    },
    next() {
      this._i++
      if (this._i === 26) return {done: true}
      else return {done: false, value: String.fromCharCode(this._i + this._b)}
    }
  }]
}

class rc {
  static construct() {
    this.input = ''
    this.ptr = 0
  }
  static readString() {
    return this.input[this.ptr++]
  }

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

  static readInt() {
    return +this.readString()
  }

  static readInts() {
    return this.readStrings().map(a => +a)
  }

  static readBigInteger() {
    return bg(this.readString())
  }

  static readBigIntegers() {
    return this.readStrings().map(a => bg(a))
  }
}

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

rc.construct()
// bc.construct()
process.stdin.on('data', (i) => {
  rc.input += i
})

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

function main() {
  let t = rc.readInts()
  while(t--) {
    const n = rc.readInt()
    const a = rc.readInts()
    const b = rc.readInts()
    let f = true

    for(let i = 1; i < n; i++) {
      if(a[i] < a[i - 1]) f = false
    }
    // wr(f)
    if(f) {
      wr('Yes')
      continue
    }

    let no0 = 0
    let no1 = 0
    b.forEach(a => {
      if(a === 0) no0++
      else no1++
    })

    if((no0 >= 2 && no1 >= 1) || (no1 >= 2 && no0 >= 1)) {
      wr('Yes')
    }
    else if(n === 2 && no0 >= 1 && no1 >= 1) wr('Yes')
    else wr('No')
  }
}

//↓見なくていいよ！ここから--------------------------------------------------
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);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  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();
		var alist = nextIntArray();
		var blist = nextIntArray();
		if(blist.indexOf(0) != -1 && blist.indexOf(1) != -1){
			output[i] = "Yes";
			continue;
		}
		var isOK = true;
		for(var j = 0; j < N - 1; j++){
			if(alist[j] > alist[j + 1]){
				isOK = false;
				break;
			}
		}
		if(isOK){
			output[i] = "Yes";
		}else{
			output[i] = "No";
		}
	}
	myout(myconv(output,9));
}

const input = [];

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

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

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

readLine.on("close", () => {
  let i = 1;
  for (let t = 0; t < parseInt(input[0]); t += 1) {
    const nums = splbsi(input[i + 1]);
    const bit = splbsi(input[i + 2]);

    let countZero = 0,
      countOne = 0,
      sorted = true;

    for (let j = 0; j < nums.length; j += 1) {
      if (bit[j] === 0) countZero += 1;
      else countOne += 1;
      if (j !== 0) {
        if (nums[j] < nums[j - 1]) sorted = false;
      }
    }

    if (sorted || (countOne > 0 && countZero > 0)) console.log("Yes");
    else console.log("No");
    i += 3;
  }
});

const processData = (lines) => {
  let acc = 0
  const num = lines[acc]
  acc++
  for (let i=0; i<num; i++) {
    const n = +lines[acc]
    acc++
    const as = lines[acc].split(' ').map(x => +x)
    acc++
    const bs = lines[acc].split(' ').map(x => +x)
    acc++
    let couldBeSorted = false
    let types = [0, 0]
    for (const t of bs) {
      types[t] = 1
    }
    if (types[0] + types[1] === 2) {
      couldBeSorted = true
    }

    if (couldBeSorted) {
      console.log('Yes')
    } else {
      let isSorted = true
      for (let i=1; i<as.length; i++) {
        if (as[i-1] > as[i]) {
          isSorted = false
          break
        }
      }
      if (isSorted) {
        console.log('Yes')
      } else {
        console.log('No')
      }
    }
  }
}

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

'use strict';

const fs = require('fs');

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

// function sol(n, m, matrix) {
// 	console.log(n, m, matrix);
// }

// sol(12,12,4)

function main() {

	const t = parseInt(readLine(), 10);

	for (let tNum = 0; tNum < t; tNum++) {
			const elementsNum = parseInt(readLine(), 10);

			const elementsArray = readLine().split(' ').map(aTemp => parseInt(aTemp, 10));

			const operationsArray = readLine().split(' ').map(aTemp => parseInt(aTemp, 10));

			let isSorted = true;

			let max = elementsArray[0];
			elementsArray.every(elem => {
				if (elem >= max) {
					max = elem;

					return true;
				} else {
					isSorted = false;

					return false;
				}
			});

			let zeroCount = 0;
			let oneCount = 0;

			operationsArray.forEach(op => {
				if (op == 0) {
					zeroCount++;
				} else {
					oneCount++;
				}
			});

			const canSort = zeroCount && oneCount;

			console.log(isSorted || canSort ? 'YES' : '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++];
}
/**
5
4
10 20 20 30
0 1 0 1
3
3 1 2
0 1 1
4
2 2 4 8
1 1 1 1
3
5 15 4
0 0 0
4
20 10 100 50
1 0 0 1

**/

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

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

function main() {
    let range = parseInt(readline());

    for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map(Number);
        let b = readline().split(" ").map(Number);

        let unique = new Set([...b]);

        if(unique.size === 2) {
            console.log('Yes');
            continue;
        }

        let sorted = 1;

        for(let i=1;i<a.length;i++) {
            if(a[i] < a[i-1]) {
                sorted = 0;
            }
        }

        if(sorted) {
            console.log('Yes');
        } else {
            console.log('No');
        }

    }
}

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var n = parseInt(readline());
  var a = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var b = readline()
    .split(" ")
    .map((val) => parseInt(val));
  print(a, b);
  var fail = false;
  for (var i = 0; i < n; i++) {
    if (fail) break;
    for (var j = i + 1; j < n; j++) {
      if (a[i] > a[j] && b[i] == b[j]) {
        fail = true;
        break;
      }
    }
  }
  if (fail) print("No");
  print("Yes");
}

function is_sorted(arr) {
  for (var i = 1; i < arr.length; i++) {
    if (arr[i] < arr[i - 1]) return false;
  }
  return true;
}
var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var n = parseInt(readline());
  var a = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var b = readline()
    .split(" ")
    .map((val) => parseInt(val));
  if (is_sorted(a) || (a.includes(0) && a.includes(1))) print("Yes");
  else print("No");
}

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var n = parseInt(readline());
  var a = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var b = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var fail = false;
  for (var i = 0; i < n; i++) {
    if (fail) break;
    for (var j = i + 1; j < n; j++) {
      if (a[i] > a[j] && b[i] == b[j]) {
        fail = true;
        break;
      }
    }
  }
  if (fail) print("No");
  else print("Yes");
}

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var n = parseInt(readline());
  var a = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var b = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var fail;
  for (var i = 0; i < n; i++) {
    if (fail) break;
    for (var j = i + 1; j < n; j++) {
      if (a[i] > a[j] && b[i] == b[j]) {
        fail = true;
        break;
      }
    }
  }
  if (fail) print("No");
  print("Yes");
}

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

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var n = +readline();
    var els = readNumArray();
    var vals = readNumArray();
    var last0 = 0;
    var last1 = 0;
    for (var j = 0; j < n; j++) {
      if (vals[j] === 0) {
        if (els[j] - last0 < 0) {
          print("No");
          break;
        }
        last0 = els[j];
      }
      if (vals[j] === 1) {
        if (els[j] - last1 < 0) {
          print("No");
          break;
        }
        last1 = els[j];
      }
      if (j === n - 1) {
        print("Yes");
      }
    }
  }
}

main();

// const bg = require('big-integer')
process.stdin.resume()
process.stdin.setEncoding('utf-8')
const MOD1 = 1000000007

function alpha(c = 'A') {
  return [...{
    _b: c === 'A' ? 65 : 97,
    _i: -1,
    [Symbol.iterator]() {
      return this
    },
    next() {
      this._i++
      if (this._i === 26) return {done: true}
      else return {done: false, value: String.fromCharCode(this._i + this._b)}
    }
  }]
}

class rc {
  static construct() {
    this.input = ''
    this.ptr = 0
  }
  static readString() {
    return this.input[this.ptr++]
  }

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

  static readInt() {
    return +this.readString()
  }

  static readInts() {
    return this.readStrings().map(a => +a)
  }

  static readBigInteger() {
    return bg(this.readString())
  }

  static readBigIntegers() {
    return this.readStrings().map(a => bg(a))
  }
}

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

rc.construct()
// bc.construct()
process.stdin.on('data', (i) => {
  rc.input += i
})

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

function main() {
  let t = rc.readInts()
  while(t--) {
    const n = rc.readInt()
    const a = rc.readInts()
    const b = rc.readInts()
    let f = true
    a.sort((a, b) => {
      if(a > b) {
        f = false
      }
      return a - b
    })
    if(f) {
      wr('Yes')
      continue
    }

    let no0 = 0
    let no1 = 0
    b.forEach(a => {
      if(a === 0) no0++
      else no1++
    })

    if((no0 >= 2 && no1 >= 1) || (no1 >= 2 && no0 >= 1)) {
      wr('Yes')
    }
    else wr('No')
  }
}

// const bg = require('big-integer')
process.stdin.resume()
process.stdin.setEncoding('utf-8')
const MOD1 = 1000000007

function alpha(c = 'A') {
  return [...{
    _b: c === 'A' ? 65 : 97,
    _i: -1,
    [Symbol.iterator]() {
      return this
    },
    next() {
      this._i++
      if (this._i === 26) return {done: true}
      else return {done: false, value: String.fromCharCode(this._i + this._b)}
    }
  }]
}

class rc {
  static construct() {
    this.input = ''
    this.ptr = 0
  }
  static readString() {
    return this.input[this.ptr++]
  }

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

  static readInt() {
    return +this.readString()
  }

  static readInts() {
    return this.readStrings().map(a => +a)
  }

  static readBigInteger() {
    return bg(this.readString())
  }

  static readBigIntegers() {
    return this.readStrings().map(a => bg(a))
  }
}

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

rc.construct()
// bc.construct()
process.stdin.on('data', (i) => {
  rc.input += i
})

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

function main() {
  let t = rc.readInts()
  while(t--) {
    const n = rc.readInt()
    const a = rc.readInts()
    const b = rc.readInts()
    let f = true

    for(let i = 1; i < n; i++) {
      if(a[i] < a[i - 1]) f = false
    }
    // wr(f)
    if(f) {
      wr('Yes')
      continue
    }

    let no0 = 0
    let no1 = 0
    b.forEach(a => {
      if(a === 0) no0++
      else no1++
    })

    if((no0 >= 2 && no1 >= 1) || (no1 >= 2 && no0 >= 1)) {
      wr('Yes')
    }
    else wr('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++];
}
/**
5
4
10 20 20 30
0 1 0 1
3
3 1 2
0 1 1
4
2 2 4 8
1 1 1 1
3
5 15 4
0 0 0
4
20 10 100 50
1 0 0 1

**/

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

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

function main() {
    let range = parseInt(readline());

    for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map(Number);
        let b = readline().split(" ").map(Number);

        let aCopy = [...a];
        aCopy.sort((a,b) => a-b);

        for(let i=0;i<a.length-1;i++) {
            for(let j=i+1;j<a.length;j++) {
                if(b[i] !== b[j] && a[i] > a[j]) {
                    [a[i], a[j]] = [a[j], a[i]];
                    [b[i], b[j]] = [b[j], b[i]];
                }
            }

        }

        let notSorted = false;
        for(let i=0;i<a.length;i++) {
            if(aCopy[i] !== a[i]) {
                notSorted = true;
            }
        }

        if(notSorted) {
            console.log('No');
        } else {
            console.log('Yes');
        }
    }
}

'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++];
}
/**
5
4
10 20 20 30
0 1 0 1
3
3 1 2
0 1 1
4
2 2 4 8
1 1 1 1
3
5 15 4
0 0 0
4
20 10 100 50
1 0 0 1

**/

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

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

function main() {
    let range = parseInt(readline());

    for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map(Number);
        let b = readline().split(" ").map(Number);

        let aCopy = [...a];
        aCopy.sort((a,b) => a-b);

        for(let i=1;i<a.length;i++) {
            if(b[i] !== b[i-1] && a[i] < a[i-1]) {
                let temp = a[i];
                a[i] = a[i-1];
                a[i-1] = temp;

                let tempB = b[i];
                b[i] = b[i-1];
                b[i-1] = tempB;
            }
        }

        let notSorted = false;
        for(let i=0;i<a.length;i++) {
            if(aCopy[i] !== a[i]) {
                notSorted = true;
            }
        }

        if(notSorted) {
            console.log('No');
        } else {
            console.log('Yes');
        }
    }
}

'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++];
}
/**
5
4
10 20 20 30
0 1 0 1
3
3 1 2
0 1 1
4
2 2 4 8
1 1 1 1
3
5 15 4
0 0 0
4
20 10 100 50
1 0 0 1

**/

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

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

function main() {
    let range = parseInt(readline());

    for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map(Number);
        let b = readline().split(" ").map(Number);

        for(let i=1;i<a.length;i++) {
            if(b[i] !== b[i-1] && a[i] < a[i-1]) {
                let temp = a[i];
                a[i] = a[i-1];
                a[i-1] = temp;

                let tempB = b[i];
                b[i] = b[i-1];
                b[i-1] = tempB;
            }
        }

        let aCopy = [...a];
        aCopy.sort((a,b) => a-b);

        let notSorted = false;
        for(let i=0;i<a.length;i++) {
            if(aCopy[i] !== a[i]) {
                notSorted = true;
            }
        }

        if(notSorted) {
            console.log('No');
        } else {
            console.log('Yes');
        }
    }
}