//https://github.com/samchon/tstl.git

var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}
    return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),std
!function(t){function e(t,e,n){for(var r=t;!r.equals(e);r=r.next())n(r.value)
    return n}function n(t,e,n){for(var r=0;r<e;r++)n(t.value),t=t.next()
    return t}function r(t,e,n){for(var r=t;!r.equals(e);r=r.next())if(0==n(r.value))return!1
    return!0}function i(t,e,n){for(var r=t;!r.equals(e);r=r.next())if(1==n(r.value))return!0
    return!1}function o(t,e,n){return!i(t,e,n)}function s(e,n,r,i){for(void 0===i&&(i=t.equal_to);!e.equals(n);){if(r.equals(r.source().end())||!i(e.value,r.value))return!1
    e=e.next(),r=r.next()}return!0}function a(e,n,r,i,o){for(void 0===o&&(o=t.less);!e.equals(n);){if(r.equals(i)||!o(e.value,r.value))return!1
    if(o(e.value,r.value))return!0
    e=e.next(),r=r.next()}return!t.equal_to(i,i.source().end())&&!t.equal_to(r.value,i.value)}function u(e,n,r){for(var i=e;!i.equals(n);i=i.next())if(t.equal_to(i.value,r))return i
    return n}function _(t,e,n){for(var r=t;!r.equals(e);r=r.next())if(n(r.value))return r
    return e}function c(t,e,n){for(var r=t;!r.equals(e);r=r.next())if(0==n(r.value))return r
    return e}function h(e,n,r,i,o){if(void 0===o&&(o=t.equal_to),r.equals(i))return n
    for(var s=n;!e.equals(n);e=e.next())for(var a=e,u=r;t.equal_to(a.value,u.value);){if(a=a.next(),u=u.next(),u.equals(i)){s=e
        break}if(a.equals(n))return s}return s}function l(e,n,r,i,o){for(void 0===o&&(o=t.equal_to);!e.equals(n);e=e.next())for(var s=r;!s.equals(i);s=s.next())if(o(s.value,e.value))return e
    return n}function p(e,n,r){if(void 0===r&&(r=t.equal_to),!e.equals(n))for(var i=e.next();!i.equals(n);){if(t.equal_to(e.value,n.value))return e
    e=e.next(),i=i.next()}return n}function f(e,n,r,i,o){if(void 0===o&&(o=t.equal_to),r.equals(i))return e
    for(;!e.equals(n);e=e.next())for(var s=e,a=r;t.equal_to(s.value,a.value);){if(s=s.next(),a=a.next(),a.equals(i))return e
        if(s.equals(n))return n}return n}function v(e,n,r,i,o){void 0===o&&(o=t.equal_to)
    for(var s=e.advance(t.distance(e,n)-r);!e.equals(s);e=e.next())for(var a=e,u=0;t.equal_to(a.value,i);)if(a=a.next(),++u==r)return e
    return n}function d(e,n,r,i){for(void 0===i&&(i=t.equal_to);!e.equals(n)&&!r.equals(r.source().end())&&t.equal_to(e.value,r.value);)e=e.next(),r=r.next()
    return t.make_pair(e,r)}function y(e,n,r){for(var i=0,o=e;!o.equals(n);o=o.next())t.equal_to(o.value,r)&&i++
    return i}function b(t,e,n){for(var r=0,i=t;!i.equals(e);i=i.next())n(i.value)&&r++
    return r}t.for_each=e,t.for_each_n=n,t.all_of=r,t.any_of=i,t.none_of=o,t.equal=s,t.lexicographical_compare=a,t.find=u,t.find_if=_,t.find_if_not=c,t.find_end=h,t.find_first_of=l,t.adjacent_find=p,t.search=f,t.search_n=v,t.mismatch=d,t.count=y,t.count_if=b}(std||(std={}))
var std
!function(t){function e(t,e,n){for(;!t.equals(e);t=t.next())n.value=t.value,n=n.next()
    return n}function n(t,e,n){for(var r=0;r<e;r++)n.value=t.value,t=t.next(),n=n.next()
    return n}function r(t,e,n,r){for(;!t.equals(e);t=t.next())r(t.value)&&(n.value=t.value,n=n.next())
    return n}function i(t,e,n){for(e=e.prev();!e.equals(t);e=e.prev())n.value=e.value,n=n.prev()
    return n}function o(t,e,n){for(;!t.equals(e);t=t.next())t.value=n}function s(t,e,n){for(var r=0;r<e;r++)t.value=n,t=t.next()
    return t}function a(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]
    return 4==t.length?u.apply(null,t):_.apply(null,t)}function u(t,e,n,r){for(;!t.equals(e);t=t.next())n.value=r(t.value),n=n.next()
    return n}function _(t,e,n,r,i){for(;!t.equals(e);)r.value=i(t.value,n.value),t=t.next(),n=n.next(),r=r.next()
    return r}function c(t,e,n){for(;!t.equals(e);t=t.next())t.value=n()}function h(t,e,n){for(var r=0;r<e;r++)t.value=n(),t=t.next()
    return t}function l(e,n,r){void 0===r&&(r=t.equal_to)
    for(var i=e,o=e.next();!o.equals(n);)1==t.equal_to(o.value,o.prev().value)?o=o.source().erase(o):(i=o,o=o.next())
    return i}function p(e,n,r,i){if(void 0===i&&(i=t.equal_to),e.equals(n))return r
    for(r.value=e.value,e=e.next();!e.equals(n);e=e.next())i(e.value,r.value)||(r=r.next(),r.value=e.value)
    return r}function f(e,n,r){for(var i=n,o=e;!o.equals(n);)1==t.equal_to(o.value,r)?o=o.source().erase(o):(i=o,o=o.next())
    return i}function v(t,e,n){for(var r=e,i=t;!i.equals(e);)1==n(i.value)?i=i.source().erase(i):(r=i,i=i.next())
    return r}function d(e,n,r,i){for(;!e.equals(n);e=e.next())t.equal_to(e.value,i)||(r.value=e.value,r=r.next())
    return r}function y(t,e,n,r){for(;!t.equals(e);t=t.next())r(t.value)||(n.value=t.value,n=n.next())
    return n}function b(e,n,r,i){for(var o=e;!o.equals(n);o=o.next())t.equal_to(o.value,r)&&(o.value=i)}function g(t,e,n,r){for(var i=t;!i.equals(e);i=i.next())1==n(i.value)&&(i.value=r)}function x(e,n,r,i,o){for(;!e.equals(n);e=e.next())t.equal_to(e.value,i)?r.value=o:r.value=e.value,r=r.next()
    return r}function m(t,e,n,r,i){for(;!t.equals(e);t=t.next())r(t.value)?n.value=i:n.value=t.value,n=n.next()
    return n}function q(t,e){t.swap(e)}function I(t,e,n){for(;!t.equals(e);t=t.next())t.swap(n),n=n.next()
    return n}function k(t,e){for(;0==t.equals(e)&&0==t.equals(e=e.prev());)t.swap(e),t=t.next()}function w(t,e,n){for(;!e.equals(t);)e=e.prev(),n.value=e.value,n=n.next()
    return n}function R(t,e,n){for(var r=e;0==r.equals(n)&&(t.swap(r),t=t.next(),r=r.next(),!t.equals(e)););return t}function z(t,n,r,i){return i=e(n,r,i),e(t,n,i)}function C(t,e){return E(t,e)}function E(t,e){for(var n=t;!n.equals(e);n=n.next()){var r=e.index()==-1?e.source().size():e.index(),i=Math.floor(Math.random()*(r-t.index()))
    n.swap(t.advance(i))}}t.copy=e,t.copy_n=n,t.copy_if=r,t.copy_backward=i,t.fill=o,t.fill_n=s,t.transform=a,t.generate=c,t.generate_n=h,t.unique=l,t.unique_copy=p,t.remove=f,t.remove_if=v,t.remove_copy=d,t.remove_copy_if=y,t.replace=b,t.replace_if=g,t.replace_copy=x,t.replace_copy_if=m,t.iter_swap=q,t.swap_ranges=I,t.reverse=k,t.reverse_copy=w,t.rotate=R,t.rotate_copy=z,t.random_shuffle=C,t.shuffle=E}(std||(std={}))
var std
!function(t){function e(e,n,r){void 0===r&&(r=t.less),u(e.source(),e.index(),n.index()-1,r)}function n(e,n,r){void 0===r&&(r=t.less),c(e.source(),e.index(),n.index()-1,r)}function r(e,n,r,i){void 0===i&&(i=t.less),p(e.source(),e.index(),n.index(),r.index(),i)}function i(n,r,i,o,s){void 0===s&&(s=t.less)
    var a=t.distance(n,r),u=t.distance(i,o),_=new t.Vector(n,r)
    return e(_.begin(),_.end()),i=a>u?t.copy(_.begin(),_.begin().advance(u),i):t.copy(_.begin(),_.end(),i)}function o(n,r,i,o){void 0===o&&(o=t.less),e(n,i,o)}function s(e,n,r){if(void 0===r&&(r=t.less),e.equals(n))return!0
    for(var i=e.next();!i.equals(n);i=i.next()){if(!t.equal_to(i.value,e.value)&&!r(e.value,i.value))return!1
        e=e.next()}return!0}function a(e,n,r){if(void 0===r&&(r=t.less),e.equals(n))return e
    for(var i=e.next();!i.equals(n);i=i.next()){if(!t.equal_to(i.value,e.value)&&!r(e.value,i.value))return i
        e=e.next()}return n}function u(t,e,n,r){if(n==-2&&(n=t.size()-1),!(e>=n)){var i=_(t,e,n,r)
    u(t,e,i-1,r),u(t,i+1,n,r)}}function _(t,e,n,r){for(var i=t.at(e),o=e,s=n+1;;){for(;r(t.at(++o),i)&&o!=n;);for(;r(i,t.at(--s))&&s!=e;);if(o>=s)break
    l(t,o,s)}return l(t,e,s),s}function c(t,e,n,r){if(n==-2&&(n=t.size()-1),!(e>=n)){var i=h(t,e,n,r)
    c(t,e,i-1,r),c(t,i+1,n,r)}}function h(e,n,r,i){for(var o=e.at(n),s=n,a=r+1;;){for(;i(e.at(++s),o)&&s!=r;);for(;i(o,e.at(--a))&&a!=n;);if(s>=a)break
    0==t.equal_to(e.at(s),e.at(a))&&l(e,s,a)}return 0==t.equal_to(e.at(n),e.at(a))&&l(e,n,a),a}function l(t,e,n){var r=t.at(e)
    t.set(e,t.at(n)),t.set(n,r)}function p(t,e,n,r,i){r==-1&&(r=t.size())
    for(var o=e;o<n;o++){for(var s=o,a=o+1;a<r;a++)i(t.at(a),t.at(s))&&(s=a)
        o!=s&&l(t,o,s)}}t.sort=e,t.stable_sort=n,t.partial_sort=r,t.partial_sort_copy=i,t.nth_element=o,t.is_sorted=s,t.is_sorted_until=a}(std||(std={}))
var std
!function(t){function e(e,n,r){void 0===r&&(r=t.less)
    var i=function(t,e){return!r(t,e)}
    t.sort(e,n,i)}function n(e,n,r){void 0===r&&(r=t.less)
    for(var i=n.prev(),o=null,s=e;!s.equals(i);s=s.next())if(r(s.value,i.value)){o=s
        break}if(null!=o){var a=i.source()
        a.insert(o,i.value),a.erase(i)}}function r(e,n,r){void 0===r&&(r=t.less)
    var i=e.source()
    i.insert(n,e.value),i.erase(e)}function i(e,n,r){void 0===r&&(r=t.less)
    var i=o(e,n,r)
    return i.equals(n)}function o(e,n,r){void 0===r&&(r=t.less)
    for(var i=e,o=e.next();!o.equals(n);o=o.next()){if(1==r(i.value,o.value))return o
        i=o}return n}function s(e,n,r){void 0===r&&(r=t.less),t.sort(e,n,r)}t.make_heap=e,t.push_heap=n,t.pop_heap=r,t.is_heap=i,t.is_heap_until=o,t.sort_heap=s}(std||(std={}))
var std
!function(t){function e(e,n,r,i){void 0===i&&(i=t.less)
    for(var o=t.distance(e,n);o>0;){var s=Math.floor(o/2),a=e.advance(s)
        i(a.value,r)?o=s:(e=a.next(),o-=s+1)}return e}function n(e,n,r,i){void 0===i&&(i=t.less)
    for(var o=t.distance(e,n);o>0;){var s=Math.floor(o/2),a=e.advance(s)
        i(r,a.value)?o=s:(e=a.next(),o-=s+1)}return e}function r(r,i,o,s){void 0===s&&(s=t.less)
    var a=e(r,i,o,s)
    return t.make_pair(a,n(a,i,o,s))}function i(n,r,i,o){return void 0===o&&(o=t.less),n=e(n,r,i,o),!n.equals(r)&&!o(i,n.value)}t.lower_bound=e,t.upper_bound=n,t.equal_range=r,t.binary_search=i}(std||(std={}))
var std
!function(t){function e(t,e,n){for(;!t.equals(e)&&n(t.value);)t=t.next()
    for(;!t.equals(e);t=t.next())if(n(t.value))return!1
    return!0}function n(t,e,n){for(;!t.equals(e);){for(;n(t.value);)if(t=t.next(),t.equals(e))return t
    do if(e=e.prev(),t.equals(e))return t
    while(!n(e.value))
    t.swap(e),t=t.next()}return e}function r(t,e,r){return n(t,e,r)}function i(e,n,r,i,o){for(;!e.equals(n);e=e.next())o(e.value)?(r.value=e.value,r=r.next()):(i.value=e.value,i=i.next())
    return t.make_pair(r,i)}function o(e,n,r){for(var i=t.distance(e,n);i>0;){var o=Math.floor(i/2),s=e.advance(o)
    r(s.value)?(e=s.next(),i-=o+1):i=o}return e}t.is_partitioned=e,t.partition=n,t.stable_partition=r,t.partition_copy=i,t.partition_point=o}(std||(std={}))
var std
!function(t){function e(e,n,r,i,o,s){for(void 0===s&&(s=t.less);;){if(e.equals(n))return t.copy(r,i,o)
    if(r.equals(i))return t.copy(e,n,o)
    s(e.value,r.value)?(o.value=e.value,e=e.next()):(o.value=r.value,r=r.next()),o=o.next()}}function n(n,r,i,o){void 0===o&&(o=t.less)
    var s=new t.Vector(t.distance(n,i),null)
    e(n,r,r,i,s.begin()),t.copy(s.begin(),s.end(),n)}function r(e,n,r,i,o){for(void 0===o&&(o=t.less);!r.equals(i);){if(e.equals(i)||o(r.value,e.value))return!1
    o(e.value,r.value)||(r=r.next()),e=e.next()}return!0}function i(e,n,r,i,o,s){for(void 0===s&&(s=t.less);;){if(e.equals(n))return t.copy(r,i,o)
    if(r.equals(i))return t.copy(e,n,o)
    s(e.value,r.value)?(o.value=e.value,e=e.next()):s(r.value,e.value)?(o.value=r.value,r=r.next()):(o.value=e.value,e=e.next(),r=r.next()),o=o.next()}}function o(e,n,r,i,o,s){for(void 0===s&&(s=t.less);;){if(e.equals(n))return t.copy(r,i,o)
    if(r.equals(i))return t.copy(e,n,o)
    s(e.value,r.value)?e=e.next():s(r.value,e.value)?r=r.next():(o.value=e.value,o=o.next(),e=e.next(),r=r.next())}}function s(e,n,r,i,o,s){for(void 0===s&&(s=t.less);!e.equals(n)&&!r.equals(i);)t.less(e.value,r.value)?(o.value=e.value,o=o.next(),e=e.next()):t.less(r.value,e.value)?r=r.next():(e=e.next(),r=r.next())
    return t.copy(e,n,o)}function a(e,n,r,i,o,s){for(void 0===s&&(s=t.less);;){if(e.equals(n))return t.copy(r,i,o)
    if(r.equals(i))return t.copy(e,n,o)
    s(e.value,r.value)?(o.value=e.value,o=o.next(),e=e.next()):s(r.value,e.value)?(o.value=r.value,o=o.next(),r=r.next()):(e=e.next(),r=r.next())}}t.merge=e,t.inplace_merge=n,t.includes=r,t.set_union=i,t.set_intersection=o,t.set_difference=s,t.set_symmetric_difference=a}(std||(std={}))
var std
!function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
    for(var r=e[0],i=1;i<e.length;i++)t.less(e[i],r)&&(r=e[i])
    return r}function n(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
    for(var r=e[0],i=1;i<e.length;i++)t.greater(e[i],r)&&(r=e[i])
    return r}function r(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
    for(var r=e[0],i=e[0],o=1;o<e.length;o++)t.less(e[o],r)&&(r=e[o]),t.greater(e[o],i)&&(i=e[o])
    return t.make_pair(r,i)}function i(e,n,r){void 0===r&&(r=t.less)
    var i=e
    for(e=e.next();!e.equals(n);e=e.next())r(e.value,i.value)&&(i=e)
    return i}function o(e,n,r){void 0===r&&(r=t.greater)
    var i=e
    for(e=e.next();!e.equals(n);e=e.next())r(e.value,i.value)&&(i=e)
    return i}function s(e,n,r){void 0===r&&(r=t.greater)
    var i=e,o=e
    for(e=e.next();!e.equals(n);e=e.next())r(e.value,i.value)&&(i=e),r(e.value,o.value)||(o=e)
    return t.make_pair(i,o)}function a(e,n,r,i){void 0===i&&(i=t.less)
    var o=new t.Vector([e,n,r])
    return t.sort(o.begin(),o.end(),i),o.at(1)}function u(e,n,r,i){void 0===i&&(i=t.equal_to)
    var o=t.mismatch(e,n,r)
    if(e=o.first,r=o.second,e.equals(n))return!0
    for(var s=r.advance(t.distance(e,n)),a=e;!a.equals(n);a=a.next())if(t.find(e,a,a.value).equals(a)){var u=t.count(r,s,a.value)
        if(0==u||t.count(a,n,a.value)!=u)return!1}return!0}function _(e,n,r){if(void 0===r&&(r=t.less),1==e.equals(n))return!1
    var i=n.prev()
    if(1==e.equals(i))return!1
    for(;;){var o=i,s=void 0
        if(i=i.prev(),1==r(o.value,i.value)){for(s=n.prev();0==r(s.value,i.value);)s=s.prev()
            return t.iter_swap(i,s),t.reverse(o,n),!0}if(1==i.equals(e))return t.reverse(e,n),!1}}function c(e,n,r){if(void 0===r&&(r=t.less),1==e.equals(n))return!1
    var i=n.prev()
    if(1==e.equals(i))return!1
    for(;;){var o=i,s=void 0
        if(i=i.prev(),1==r(i.value,o.value)){for(s=n.prev();0==r(i.value,s.value);)s=s.prev()
            return t.iter_swap(i,s),t.reverse(o,n),!0}if(1==i.equals(e))return t.reverse(e,n),!1}}t.min=e,t.max=n,t.minmax=r,t.min_element=i,t.max_element=o,t.minmax_element=s,t.clamp=a,t.is_permutation=u,t.prev_permutation=_,t.next_permutation=c}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(){function e(){}return e.prototype.clear=function(){this.erase(this.begin(),this.end())},e.prototype.empty=function(){return 0==this.size()},e.prototype.swap=function(e){var n=new t.Vector(this.begin(),this.end())
        this.assign(e.begin(),e.end()),e.assign(n.begin(),n.end())},e}()
        e.Container=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e=function(){function t(t){this.source_=t}return t.prototype.equals=function(t){return this.source_==t.source_},t}()
    t.Iterator=e}(std||(std={})),function(t){function e(t){return t.size()}function n(t){return t.empty()}function r(t,e){if(void 0!=t.index)return i(t,e)
    for(var n=0;!t.equals(e);t=t.next())n++
    return n}function i(t,e){return Math.abs(e.index()-t.index())}function o(t,e){return t.advance(e)}function s(t,e){return void 0===e&&(e=1),t.advance(e)}function a(t,e){return void 0===e&&(e=1),t.advance(e)}function u(t){return t.begin()}function _(t){return t.rbegin()}function c(t){return t.end()}function h(t){return t.rend()}function l(e){return e instanceof t.VectorIterator?new t.VectorReverseIterator(e):e instanceof t.DequeIterator?new t.DequeReverseIterator(e):e instanceof t.ListIterator?new t.ListReverseIterator(e):e instanceof t.SetIterator?new t.SetReverseIterator(e):e instanceof t.MapIterator?new t.MapReverseIterator(e):void 0}var p=function(t){function e(e){var n=this
    return null==e?n=t.call(this,null)||this:(n=t.call(this,e.source())||this,n.base_=e.prev()),n}return __extends(e,t),e.prototype.source=function(){return this.source_},e.prototype.base=function(){return this.base_.next()},Object.defineProperty(e.prototype,"value",{get:function(){return this.base_.value},enumerable:!0,configurable:!0}),e.prototype.prev=function(){return this._Create_neighbor(this.base().next())},e.prototype.next=function(){return this._Create_neighbor(this.base().prev())},e.prototype.advance=function(t){return this._Create_neighbor(this.base().advance(-t))},e.prototype.equals=function(t){return this.base_.equals(t.base_)},e.prototype.swap=function(t){this.base_.swap(t.base_)},e}(t.Iterator)
    t.ReverseIterator=p,t.size=e,t.empty=n,t.distance=r,t.advance=o,t.prev=s,t.next=a,t.begin=u,t.rbegin=_,t.end=c,t.rend=h,t.make_reverse_iterator=l}(std||(std={}))
var std
!function(t){var e=function(e){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i]
    var o=e.call(this)||this
    if(o.begin_=new t.DequeIterator(o,0),o.end_=new t.DequeIterator(o,-1),o.rend_=new t.DequeReverseIterator(o.begin_),0==r.length&&o.clear(),1==r.length&&r[0]instanceof Array){var s=r[0],a=new t.base._ArrayIterator(s,0),u=new t.base._ArrayIterator(s,s.length)
        o.assign(a,u)}else if(1==r.length&&r[0]instanceof n){var _=r[0]
        o.assign(_.begin(),_.end())}else if(2==r.length&&r[0]instanceof t.Iterator&&r[1]instanceof t.Iterator){var a=r[0],u=r[1]
        o.assign(a,u)}return o}return __extends(n,e),n.prototype.assign=function(t,e){this.clear(),this.insert(this.end(),t,e)},n.prototype.reserve=function(t){if(!(t<this.capacity_)){for(var e=[[]],r=this._Compute_col_size(t),i=0;i<this.matrix_.length;i++)for(var o=this.matrix_[i],s=0;s<o.length;s++){var a=e[e.length-1]
    e.length<n.ROW_SIZE&&a.length==r&&(a=[],e.push(a)),a.push(o[s])}this.matrix_=e,this.capacity_=t}},n.prototype.clear=function(){this.matrix_=[[]],this.size_=0,this.capacity_=n.MIN_CAPACITY},n.prototype.size=function(){return this.size_},n.prototype.empty=function(){return 0==this.size_},n.prototype.capacity=function(){return this.capacity_},n.prototype.front=function(){return this.matrix_[0][0]},n.prototype.back=function(){var t=this.matrix_[this.matrix_.length-1]
    return t[t.length-1]},n.prototype.begin=function(){return 1==this.empty()?this.end_:this.begin_},n.prototype.end=function(){return this.end_},n.prototype.rbegin=function(){return new t.DequeReverseIterator(this.end_)},n.prototype.rend=function(){return 1==this.empty()?new t.DequeReverseIterator(this.end_):this.rend_},n.prototype.at=function(e){if(e<this.size()&&e>=0){var n=this._Fetch_index(e)
    return this.matrix_[n.first][n.second]}throw new t.OutOfRange("Target index is greater than Deque's size.")},n.prototype.set=function(e,n){if(e>=this.size()||e<0)throw new t.OutOfRange("Target index is greater than Deque's size.")
    var r=this._Fetch_index(e)
    this.matrix_[r.first][r.second]=n},n.prototype._Fetch_index=function(e){var n
    for(n=0;n<this.matrix_.length;n++){var r=this.matrix_[n]
        if(e<r.length)break
        e-=r.length}return n==this.matrix_.length&&n--,t.make_pair(n,e)},n.prototype._Compute_col_size=function(t){return void 0===t&&(t=this.capacity_),Math.floor(t/n.ROW_SIZE)},n.prototype.push=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
    if(0==e.length)return this.size()
    var r=new t.base._ArrayIterator(e,0),i=new t.base._ArrayIterator(e,e.length)
    return this._Insert_by_range(this.end(),r,i),this.size()},n.prototype.push_front=function(t){this._Try_expand_capacity(this.size_+1),this._Try_add_row_at_front(),this.matrix_[0].unshift(t),this.size_++},n.prototype.push_back=function(t){this._Try_expand_capacity(this.size_+1),this._Try_add_row_at_back(),this.matrix_[this.matrix_.length-1].push(t),this.size_++},n.prototype.pop_front=function(){1!=this.empty()&&(this.matrix_[0].shift(),0==this.matrix_[0].length&&this.matrix_.length>1&&this.matrix_.shift(),this.size_--)},n.prototype.pop_back=function(){if(1!=this.empty()){var t=this.matrix_[this.matrix_.length-1]
    t.pop(),0==t.length&&this.matrix_.length>1&&this.matrix_.pop(),this.size_--}},n.prototype.insert=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
    var r,i=!1
    return e[0]instanceof t.DequeReverseIterator&&(i=!0,e[0]=e[0].base().prev()),r=2==e.length?this._Insert_by_val(e[0],e[1]):3==e.length&&"number"==typeof e[1]?this._Insert_by_repeating_val(e[0],e[1],e[2]):this._Insert_by_range(e[0],e[1],e[2]),1==i?new t.DequeReverseIterator(r.next()):r},n.prototype._Insert_by_val=function(t,e){return this._Insert_by_repeating_val(t,1,e)},n.prototype._Insert_by_repeating_val=function(e,n,r){var i=new t.base._Repeater(0,r),o=new t.base._Repeater(n)
    return this._Insert_by_range(e,i,o)},n.prototype._Insert_by_range=function(e,r,i){var o=this.size_+t.distance(r,i)
    if(o==this.size_)return e
    if(1==e.equals(this.end()))this._Try_expand_capacity(o),this._Insert_to_end(r,i),e=new t.DequeIterator(this,this.size_)
    else if(o>this.capacity_){var s=new n
        s.reserve(Math.max(o,Math.floor(this.capacity_*n.MAGNIFIER))),s._Insert_to_end(this.begin(),e),s._Insert_to_end(r,i),s._Insert_to_end(e,this.end()),this.swap(s)}else this._Insert_to_middle(e,r,i)
    return this.size_=o,e},n.prototype._Insert_to_middle=function(e,r,i){for(var o=this._Compute_col_size(),s=this._Fetch_index(e.index()),a=this.matrix_[s.first],u=s.second,_=a.splice(u);!r.equals(i);r=r.next()){if(a.length==o&&this.matrix_.length<n.ROW_SIZE){a=new Array
    var c=this.matrix_.splice(++s.first)
    this.matrix_.push(a),(l=this.matrix_).push.apply(l,c)}a.push(r.value)}for(var h=(new t.base._ArrayIterator(_,0),new t.base._ArrayIterator(_,_.length),0);h<_.length;h++){if(a.length==o&&this.matrix_.length<n.ROW_SIZE){a=new Array
    var c=this.matrix_.splice(++s.first)
    this.matrix_.push(a),(p=this.matrix_).push.apply(p,c)}a.push(_[h])}var l,p},n.prototype._Insert_to_end=function(t,e){for(;!t.equals(e);t=t.next())this._Try_add_row_at_back(),this.matrix_[this.matrix_.length-1].push(t.value)},n.prototype._Try_expand_capacity=function(t){return!(t<=this.capacity_)&&(t=Math.max(t,Math.floor(this.capacity_*n.MAGNIFIER)),this.reserve(t),!0)},n.prototype._Try_add_row_at_front=function(){var t=this._Compute_col_size()
    return this.matrix_[0].length>=t&&this.matrix_.length<n.ROW_SIZE&&(this.matrix_=(e=[[]]).concat.apply(e,this.matrix_),!0)
    var e},n.prototype._Try_add_row_at_back=function(){var t=this._Compute_col_size()
    return this.matrix_[this.matrix_.length-1].length>=t&&this.matrix_.length<n.ROW_SIZE&&(this.matrix_.push([]),!0)},n.prototype.erase=function(e,n){void 0===n&&(n=e.next())
    var r,i=!1
    if(e instanceof t.DequeReverseIterator){i=!0
        var o=n.base(),s=e.base()
        e=o,n=s}return r=this._Erase_by_range(e,n),1==i?new t.DequeReverseIterator(r.next()):r},n.prototype._Erase_by_range=function(t,e){if(t.index()==-1)return t
    var n
    n=e.index()==-1?this.size()-t.index():e.index()-t.index(),this.size_-=n
    for(var r=null,i=null,o=0;0!=n;){var s=this._Fetch_index(t.index()),a=this.matrix_[s.first],u=s.second,_=Math.min(n,a.length-u)
        a.splice(u,_),0!=a.length&&(0==o?r=a:i=a),0==a.length&&this.matrix_.length>1&&this.matrix_.splice(s.first,1),n-=_,o++}return null!=r&&null!=i&&r.length+i.length<=this._Compute_col_size()&&(r.push.apply(r,i),this.matrix_.splice(this.matrix_.indexOf(i),1)),e.index()==-1?this.end():t},n.prototype.swap=function(t){t instanceof n?(r=[t.matrix_,this.matrix_],this.matrix_=r[0],t.matrix_=r[1],i=[t.size_,this.size_],this.size_=i[0],t.size_=i[1],o=[t.capacity_,this.capacity_],this.capacity_=o[0],t.capacity_=o[1]):e.prototype.swap.call(this,t)
    var r,i,o},Object.defineProperty(n,"ROW_SIZE",{get:function(){return 8},enumerable:!0,configurable:!0}),Object.defineProperty(n,"MIN_CAPACITY",{get:function(){return 36},enumerable:!0,configurable:!0}),Object.defineProperty(n,"MAGNIFIER",{get:function(){return 1.5},enumerable:!0,configurable:!0}),n}(t.base.Container)
    t.Deque=e}(std||(std={})),function(t){var e=function(t){function e(e,n){var r=t.call(this,e)||this
    return r.index_=n,r}return __extends(e,t),e.prototype.source=function(){return this.source_},e.prototype.index=function(){return this.index_},Object.defineProperty(e.prototype,"value",{get:function(){return this.source().at(this.index_)},set:function(t){this.source().set(this.index_,t)},enumerable:!0,configurable:!0}),e.prototype.prev=function(){return this.index_==-1?new e(this.source(),this.source_.size()-1):this.index_-1<0?this.source().end():new e(this.source(),this.index_-1)},e.prototype.next=function(){return this.index_>=this.source_.size()-1?this.source().end():new e(this.source(),this.index_+1)},e.prototype.advance=function(t){var n
    return n=t<0&&this.index_==-1?this.source_.size()+t:this.index_+t,n<0||n>=this.source_.size()?this.source().end():new e(this.source(),n)},e.prototype.equals=function(e){return t.prototype.equals.call(this,e)&&this.index_==e.index_},e.prototype.swap=function(t){e=[t.value,this.value],this.value=e[0],t.value=e[1]
    var e},e}(t.Iterator)
    t.DequeIterator=e}(std||(std={})),function(t){var e=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype._Create_neighbor=function(t){return new e(t)},e.prototype.index=function(){return this.base_.index()},Object.defineProperty(e.prototype,"value",{get:function(){return this.base_.value},set:function(t){this.base_.value=t},enumerable:!0,configurable:!0}),e}(t.ReverseIterator)
    t.DequeReverseIterator=e}(std||(std={}))
var std
!function(t){function e(){null!=f&&f(),1==t.is_node()?process.exit():(window.open("","_self",""),window.close())}function n(e){f=e,1==t.is_node()?process.on("uncaughtException",function(t){f()}):window.onerror=function(t,e,n,r,i){f()}}function r(){return f}t.terminate=e,t.set_terminate=n,t.get_terminate=r
    var i=function(){function t(t){void 0===t&&(t=""),this.message_=t}return t.prototype.what=function(){return this.message_},t}()
    t.Exception=i
    var o=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e}(i)
    t.LogicError=o
    var s=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e}(o)
    t.DomainError=s
    var a=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e}(o)
    t.InvalidArgument=a
    var u=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e}(o)
    t.LengthError=u
    var _=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e}(o)
    t.OutOfRange=_
    var c=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e}(i)
    t.RuntimeError=c
    var h=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e}(c)
    t.OverflowError=h
    var l=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e}(c)
    t.UnderflowError=l
    var p=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e}(c)
    t.RangeError=p
    var f=null}(std||(std={}))
var std
!function(t){function e(t,e){return t instanceof Object&&t.equals?t.equals(e):t==e}function n(t,n){return!e(t,n)}function r(t,e){return t instanceof Object?void 0!=t.less?t.less(e):t.__get_m_iUID()<e.__get_m_iUID():t<e}function i(t,n){return r(t,n)||e(t,n)}function o(t,e){return!i(t,e)}function s(t,e){return!r(t,e)}function a(t,e){return t&&e}function u(t,e){return t||e}function _(t){return!t}function c(t,e){return t&e}function h(t,e){return t|e}function l(t,e){return t^e}function p(t){var e=typeof t
    return"number"==e?f(t):"string"==e?v(t):d(t)}function f(t){var e=new ArrayBuffer(8),n=new Int8Array(e),r=new Float64Array(e)
    r[0]=t
    for(var i=2166136261,o=0;o<n.length;o++){var s=n[o]<0?n[o]+256:n[o]
        i^=s,i*=16777619}return Math.abs(i)}function v(t){for(var e=2166136261,n=0;n<t.length;n++)e^=t.charCodeAt(n),e*=16777619
    return Math.abs(e)}function d(t){return void 0!=t.hashCode?t.hashCode():f(t.__get_m_iUID())}function y(t,e){t.swap(e)}t.equal_to=e,t.not_equal_to=n,t.less=r,t.less_equal=i,t.greater=o,t.greater_equal=s,t.logical_and=a,t.logical_or=u,t.logical_not=_,t.bit_and=c,t.bit_or=h,t.bit_xor=l,t.hash=p
    var b
    void 0==b&&(b=0),0==Object.prototype.hasOwnProperty("__get_m_iUID")&&Object.defineProperties(Object.prototype,{__get_m_iUID:{value:function(){if(0==this.hasOwnProperty("__m_iUID")){var t=++b
        Object.defineProperty(this,"__m_iUID",{get:function(){return t}})}return this.__m_iUID}}}),t.swap=y}(std||(std={})),function(t){function e(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r]
    for(var i=null,o=[],s=0,a=0;a<n.length;a++){if(0==a&&n[0]instanceof Object&&n[0]instanceof t.placeholders.PlaceHolder==0){for(var u in n[0])if(n[0][u]==e){i=n[0]
        break}if(null!=i)continue}n[a]instanceof t.placeholders.PlaceHolder&&s++,o.push(n[a])}var _=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r]
        if(0==n.length)return e.apply(i,o)
        var a=i,u=o.slice()
        if(null==a&&(0==o.length||o[0]instanceof t.placeholders.PlaceHolder)&&n[0]instanceof Object)for(var _ in n[0])if(n[0][_]==e){a=n[0],u.splice(0,1)
            break}for(var c=0;c<u.length;c++)u[c]instanceof t.placeholders.PlaceHolder&&(u[c]=n[u[c].index()-1])
        if(n.length>s)for(var c=s;c<n.length;c++){if(0==c&&null==i&&null!=a)continue
            u.push(n[c])}return e.apply(a,u)}
    return _}t.bind=e}(std||(std={})),function(t){var e
    !function(t){var e=function(){function t(t){this.index_=t}return t.prototype.index=function(){return this.index_},t}()
        t.PlaceHolder=e,t._1=new e(1),t._2=new e(2),t._3=new e(3),t._4=new e(4),t._5=new e(5),t._6=new e(6),t._7=new e(7),t._8=new e(8),t._9=new e(9),t._10=new e(10),t._11=new e(11),t._12=new e(12),t._13=new e(13),t._14=new e(14),t._15=new e(15),t._16=new e(16),t._17=new e(17),t._18=new e(18),t._19=new e(19),t._20=new e(20)}(e=t.placeholders||(t.placeholders={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(n){function r(){var t=n.call(this)||this
        return t.end_=t._Create_iterator(null,null,null),t.end_.prev_=t.end_,t.end_.next_=t.end_,t._Set_begin(t.end_),t.size_=0,t}return __extends(r,n),r.prototype._Set_begin=function(t){this.begin_=t},r.prototype.assign=function(t,e){this.clear(),this.insert(this.end(),t,e)},r.prototype.clear=function(){this._Set_begin(this.end_),this.end_.prev_=this.end_,this.end_.next_=this.end_,this.size_=0},r.prototype.begin=function(){return this.begin_},r.prototype.end=function(){return this.end_},r.prototype.size=function(){return this.size_},r.prototype.front=function(){return this.begin_.value},r.prototype.back=function(){return this.end_.prev().value},r.prototype.push_front=function(t){this.insert(this.begin_,t)},r.prototype.push_back=function(t){this.insert(this.end_,t)},r.prototype.pop_front=function(){this.erase(this.begin_)},r.prototype.pop_back=function(){this.erase(this.end_.prev())},r.prototype.push=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n]
        if(0==t.length)return this.size()
        var r=new e._ArrayIterator(t,0),i=new e._ArrayIterator(t,t.length)
        return this._Insert_by_range(this.end(),r,i),this.size()},r.prototype.insert=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]
        var n
        return n=2==t.length?this._Insert_by_repeating_val(t[0],1,t[1]):3==t.length&&"number"==typeof t[1]?this._Insert_by_repeating_val(t[0],t[1],t[2]):this._Insert_by_range(t[0],t[1],t[2])},r.prototype._Insert_by_repeating_val=function(t,n,r){var i=new e._Repeater(0,r),o=new e._Repeater(n)
        return this._Insert_by_range(t,i,o)},r.prototype._Insert_by_range=function(e,n,r){if(this!=e.source_)throw new t.InvalidArgument("Parametric iterator is not this container's own.")
        for(var i=e.prev(),o=null,s=0,a=n;0==a.equals(r);a=a.next()){var u=this._Create_iterator(i,null,a.value)
            0==s&&(o=u),i.next_=u,i=u,s++}return 1==e.equals(this.begin())&&this._Set_begin(o),i.next_=e,e.prev_=i,this.size_+=s,o},r.prototype.erase=function(t,e){return void 0===e&&(e=t.next()),this._Erase_by_range(t,e)},r.prototype._Erase_by_range=function(e,n){var r=e.prev(),i=t.distance(e,n)
        return r.next_=n,n.prev_=r,this.size_-=i,e.equals(this.begin_)&&this._Set_begin(n),n},r.prototype.swap=function(t){t instanceof r?(e=[t.begin_,this.begin_],this.begin_=e[0],t.begin_=e[1],i=[t.end_,this.end_],this.end_=i[0],t.end_=i[1],o=[t.size_,this.size_],this.size_=o[0],t.size_=o[1]):n.prototype.swap.call(this,t)
        var e,i,o},r}(e.Container)
        e._ListContainer=n}(e=t.base||(t.base={}))}(std||(std={})),function(t){var e
    !function(e){var n=function(t){function e(e,n,r,i){var o=t.call(this,e)||this
        return o.prev_=n,o.next_=r,o.value_=i,o}return __extends(e,t),e.prototype.prev=function(){return this.prev_},e.prototype.next=function(){return this.next_},e.prototype.advance=function(t){var e=this
        if(t>=0){for(var n=0;n<t;n++)if(e=e.next(),e.equals(this.source_.end()))return e}else for(var n=0;n<t;n++)if(e=e.prev(),e.equals(this.source_.end()))return e
        return e},Object.defineProperty(e.prototype,"value",{get:function(){return this.value_},enumerable:!0,configurable:!0}),e.prototype.equals=function(t){return this==t},e.prototype.swap=function(t){var e=this.source_,n=this.prev_,r=this.next_
        this.prev_=t.prev_,this.next_=t.next_,t.prev_=n,t.next_=r,e.end()==this?e.end_=t:e.end()==t&&(e.end_=this),e.begin()==this?e.begin_=t:e.begin()==t&&(e.begin_=this)},e}(t.Iterator)
        e._ListIteratorBase=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(n){function i(){var t=n.call(this)||this
        return t.data_=new r(t),t}return __extends(i,n),i.prototype.assign=function(t,e){this.clear(),this.insert(t,e)},i.prototype.clear=function(){this.data_.clear()},i.prototype.begin=function(){return this.data_.begin()},i.prototype.end=function(){return this.data_.end()},i.prototype.rbegin=function(){return this.data_.rbegin()},i.prototype.rend=function(){return this.data_.rend()},i.prototype.has=function(t){return!this.find(t).equals(this.end())},i.prototype.size=function(){return this.data_.size()},i.prototype.push=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r]
        for(var i=[],o=0;o<n.length;o++){var s=void 0
            s=n[o]instanceof Array?t.make_pair(n[o][0],n[o][1]):n[o],i.push(s)}var a=new e._ArrayIterator(i,0),u=new e._ArrayIterator(i,i.length)
        return this.insert(a,u),this.size()},i.prototype.emplace_hint=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r]
        return 1==n.length?this.insert(e,n[0]):this.insert(e,t.make_pair(n[0],n[1]))},i.prototype.insert=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
        if(1==e.length&&e[0]instanceof t.Pair)return this._Insert_by_pair(e[0])
        if(1==e.length&&e[0]instanceof Array)return this._Insert_by_tuple(e[0])
        if(2==e.length&&e[0]instanceof t.Iterator&&e[1]instanceof t.Iterator)return this._Insert_by_range(e[0],e[1])
        var r=void 0,i=!1
        return e[0]instanceof t.MapReverseIterator&&(i=!0,e[0]=e[0].base().prev()),r=e[1]instanceof t.Pair?this._Insert_by_hint(e[0],e[1]):this._Insert_by_hint_with_tuple(e[0],e[1]),1==i?new t.MapReverseIterator(r.next()):r},i.prototype._Insert_by_tuple=function(e){return this._Insert_by_pair(new t.Pair(e[0],e[1]))},i.prototype._Insert_by_hint_with_tuple=function(e,n){return this._Insert_by_hint(e,t.make_pair(n[0],n[1]))},i.prototype.erase=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
        return 1!=e.length||e[0]instanceof t.Iterator!=0&&e[0].source()==this?1==e.length?this._Erase_by_iterator(e[0]):this._Erase_by_iterator(e[0],e[1]):this._Erase_by_key(e[0])},i.prototype._Erase_by_key=function(t){var e=this.find(t)
        return 1==e.equals(this.end())?0:(this._Erase_by_iterator(e),1)},i.prototype._Erase_by_iterator=function(e,n){void 0===n&&(n=e.next())
        var r,i=!1
        if(e instanceof t.MapReverseIterator){i=!0
            var o=n.base(),s=e.base()
            e=o,n=s}return r=this._Erase_by_range(e,n),1==i?new t.MapReverseIterator(r.next()):r},i.prototype._Erase_by_range=function(t,e){var n=this.data_.erase(t,e)
        return this._Handle_erase(t,e),n},i.prototype._Swap=function(t){e=[t.data_,this.data_],this.data_=e[0],t.data_=e[1]
        var e},i}(e.Container)
        e.MapContainer=n
        var r=function(e){function n(t){var n=e.call(this)||this
            return n.associative_=t,n}return __extends(n,e),n.prototype._Create_iterator=function(e,n,r){return new t.MapIterator(this,e,n,r)},n.prototype._Set_begin=function(n){e.prototype._Set_begin.call(this,n),this.rend_=new t.MapReverseIterator(n)},n.prototype.associative=function(){return this.associative_},n.prototype.rbegin=function(){return new t.MapReverseIterator(this.end())},n.prototype.rend=function(){return this.rend_},n}(e._ListContainer)
        e._MapElementList=r}(e=t.base||(t.base={}))}(std||(std={})),function(t){var e=function(e){function n(t,n,r,i){return e.call(this,t,n,r,i)||this}return __extends(n,e),n.prototype.prev=function(){return this.prev_},n.prototype.next=function(){return this.next_},n.prototype.advance=function(t){return e.prototype.advance.call(this,t)},n.prototype.source=function(){return this.source_.associative()},Object.defineProperty(n.prototype,"first",{get:function(){return this.value.first},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"second",{get:function(){return this.value.second},set:function(t){this.value.second=t},enumerable:!0,configurable:!0}),n.prototype.less=function(e){return t.less(this.first,e.first)},n.prototype.equals=function(t){return this==t},n.prototype.hashCode=function(){return t.hash(this.first)},n.prototype.swap=function(t){e.prototype.swap.call(this,t)},n}(t.base._ListIteratorBase)
    t.MapIterator=e
    var n=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype._Create_neighbor=function(t){return new e(t)},Object.defineProperty(e.prototype,"first",{get:function(){return this.base_.first},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"second",{get:function(){return this.base_.second},set:function(t){this.base_.second=t},enumerable:!0,configurable:!0}),e}(t.ReverseIterator)
    t.MapReverseIterator=n}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return __extends(n,e),n.prototype.count=function(t){return this.find(t).equals(this.end())?0:1},n.prototype.get=function(e){var n=this.find(e)
        if(1==n.equals(this.end()))throw new t.OutOfRange("unable to find the matched key.")
        return n.second},n.prototype.set=function(t,e){this.insert_or_assign(t,e)},n.prototype.emplace=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
        return 1==e.length?this._Insert_by_pair(e[0]):this._Insert_by_pair(t.make_pair(e[0],e[1]))},n.prototype.insert=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n]
        return e.prototype.insert.apply(this,t)},n.prototype.insert_or_assign=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
        if(2==e.length)return this._Insert_or_assign_with_key_value(e[0],e[1])
        if(3==e.length){var r=void 0,i=!1
            return e[0]instanceof t.MapReverseIterator&&(i=!0,e[0]=e[0].base().prev()),r=this._Insert_or_assign_with_hint(e[0],e[1],e[2]),1==i?new t.MapReverseIterator(r.next()):r}},n.prototype._Insert_or_assign_with_key_value=function(e,n){var r=this.find(e)
        return 1==r.equals(this.end())?this._Insert_by_pair(t.make_pair(e,n)):(r.second=n,t.make_pair(r,!1))},n.prototype._Insert_or_assign_with_hint=function(t,e,n){return this._Insert_or_assign_with_key_value(e,n).first},n.prototype.extract=function(e){return e instanceof t.MapIterator?this._Extract_by_iterator(e):e instanceof t.MapReverseIterator?this._Extract_by_reverse_iterator(e):this._Extract_by_key(e)},n.prototype._Extract_by_key=function(e){var n=this.find(e)
        if(1==n.equals(this.end()))throw new t.OutOfRange("No such key exists.")
        var r=n.value
        return this.erase(n),r},n.prototype._Extract_by_iterator=function(t){return 1==t.equals(this.end())?this.end():(this.erase(t),t)},n.prototype._Extract_by_reverse_iterator=function(t){return this._Extract_by_iterator(t.base().next()),t},n.prototype.merge=function(t){for(var e=t.begin();!e.equals(t.end());)0==this.has(e.first)?(this.insert(e.value),e=t.erase(e)):e=e.next()},n}(e.MapContainer)
        e.UniqueMap=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return __extends(n,e),n.prototype.emplace=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
        return 1==e.length?this._Insert_by_pair(e[0]):this._Insert_by_pair(t.make_pair(e[0],e[1]))},n.prototype.insert=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n]
        return e.prototype.insert.apply(this,t)},n.prototype.merge=function(t){this.insert(t.begin(),t.end()),t.clear()},n}(e.MapContainer)
        e.MultiMap=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e=function(e){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i]
    var o=e.call(this)||this
    if(o.hash_buckets_=new t.base._MapHashBuckets(o),0==r.length);else if(1==r.length&&r[0]instanceof n){var s=r[0]
        o.assign(s.begin(),s.end())}else if(1==r.length&&r[0]instanceof Array){var a=r[0]
        o.rehash(a.length*t.base._Hash.RATIO),o.push.apply(o,a)}else if(2==r.length&&r[0]instanceof t.Iterator&&r[1]instanceof t.Iterator){var u=r[0],_=r[1]
        o.assign(u,_)}return o}return __extends(n,e),n.prototype.clear=function(){this.hash_buckets_.clear(),e.prototype.clear.call(this)},n.prototype.find=function(t){return this.hash_buckets_.find(t)},n.prototype.begin=function(t){return void 0===t&&(t=-1),t==-1?e.prototype.begin.call(this):this.hash_buckets_.at(t).front()},n.prototype.end=function(t){return void 0===t&&(t=-1),t==-1?e.prototype.end.call(this):this.hash_buckets_.at(t).back().next()},n.prototype.rbegin=function(n){return void 0===n&&(n=-1),n==-1?e.prototype.rbegin.call(this):new t.MapReverseIterator(this.end(n))},n.prototype.rend=function(n){return void 0===n&&(n=-1),n==-1?e.prototype.rend.call(this):new t.MapReverseIterator(this.begin(n))},n.prototype.bucket_count=function(){return this.hash_buckets_.size()},n.prototype.bucket_size=function(t){return this.hash_buckets_.at(t).size()},n.prototype.max_load_factor=function(t){return void 0===t&&(t=-1),t==-1?this.size()/this.bucket_count():void this.rehash(Math.ceil(this.bucket_count()/t))},n.prototype.bucket=function(e){return t.hash(e)%this.hash_buckets_.size()},n.prototype.reserve=function(t){this.hash_buckets_.rehash(Math.ceil(t*this.max_load_factor()))},n.prototype.rehash=function(t){t<=this.bucket_count()||this.hash_buckets_.rehash(t)},n.prototype._Insert_by_pair=function(e){var n=this.find(e.first)
    return 0==n.equals(this.end())?t.make_pair(n,!1):(this.data_.push_back(e),n=n.prev(),this._Handle_insert(n,n.next()),t.make_pair(n,!0))},n.prototype._Insert_by_hint=function(t,e){var n=this.find(e.first)
    return 1==n.equals(this.end())&&(n=this.data_.insert(t,e),this._Handle_insert(n,n.next())),n},n.prototype._Insert_by_range=function(e,n){for(var r=this.end().prev(),i=0;!e.equals(n);e=e.next())this.has(e.value.first)||(this.data_.push_back(t.make_pair(e.value.first,e.value.second)),i++)
    r=r.next(),this.size()+i>this.hash_buckets_.size()*t.base._Hash.MAX_RATIO&&this.hash_buckets_.rehash((this.size()+i)*t.base._Hash.RATIO),this._Handle_insert(r,this.end())},n.prototype._Handle_insert=function(t,e){for(;!t.equals(e);t=t.next())this.hash_buckets_.insert(t)},n.prototype._Handle_erase=function(t,e){for(;!t.equals(e);t=t.next())this.hash_buckets_.erase(t)},n.prototype.swap=function(t){t instanceof n?(this._Swap(t),r=[t.hash_buckets_,this.hash_buckets_],this.hash_buckets_=r[0],t.hash_buckets_=r[1]):e.prototype.swap.call(this,t)
    var r},n}(t.base.UniqueMap)
    t.HashMap=e}(std||(std={}))
var std
!function(t){var e=function(e){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i]
    var o=e.call(this)||this
    if(o.hash_buckets_=new t.base._MapHashBuckets(o),0==r.length);else if(1==r.length&&r[0]instanceof n){var s=r[0]
        o.assign(s.begin(),s.end())}else if(1==r.length&&r[0]instanceof Array){var a=r[0]
        o.rehash(a.length*t.base._Hash.RATIO),o.push.apply(o,a)}else if(2==r.length&&r[0]instanceof t.Iterator&&r[1]instanceof t.Iterator){var u=r[0],_=r[1]
        o.assign(u,_)}return o}return __extends(n,e),n.prototype.clear=function(){this.hash_buckets_.clear(),e.prototype.clear.call(this)},n.prototype.find=function(t){return this.hash_buckets_.find(t)},n.prototype.count=function(e){for(var n=t.hash(e)%this.hash_buckets_.item_size(),r=this.hash_buckets_.at(n),i=0,o=0;o<r.size();o++)t.equal_to(r.at(o).first,e)&&i++
    return i},n.prototype.begin=function(t){return void 0===t&&(t=-1),t==-1?e.prototype.begin.call(this):this.hash_buckets_.at(t).front()},n.prototype.end=function(t){return void 0===t&&(t=-1),t==-1?e.prototype.end.call(this):this.hash_buckets_.at(t).back().next()},n.prototype.rbegin=function(e){return void 0===e&&(e=-1),new t.MapReverseIterator(this.end(e))},n.prototype.rend=function(e){return void 0===e&&(e=-1),new t.MapReverseIterator(this.begin(e))},n.prototype.bucket_count=function(){return this.hash_buckets_.size()},n.prototype.bucket_size=function(t){return this.hash_buckets_.at(t).size()},n.prototype.max_load_factor=function(t){return void 0===t&&(t=-1),t==-1?this.size()/this.bucket_count():void this.rehash(Math.ceil(this.bucket_count()/t))},n.prototype.bucket=function(e){return t.hash(e)%this.hash_buckets_.size()},n.prototype.reserve=function(t){this.hash_buckets_.rehash(Math.ceil(t*this.max_load_factor()))},n.prototype.rehash=function(t){t<=this.bucket_count()||this.hash_buckets_.rehash(t)},n.prototype._Insert_by_pair=function(t){var e=this.data_.insert(this.data_.end(),t)
    return this._Handle_insert(e,e.next()),e},n.prototype._Insert_by_hint=function(t,e){var n=this.data_.insert(t,e)
    return this._Handle_insert(n,n.next()),n},n.prototype._Insert_by_range=function(e,n){var r=this.data_.insert(this.data_.end(),e,n)
    this.size()>this.hash_buckets_.item_size()*t.base._Hash.MAX_RATIO&&this.hash_buckets_.rehash(this.size()*t.base._Hash.RATIO),this._Handle_insert(r,this.end())},n.prototype._Handle_insert=function(t,e){for(;!t.equals(e);t=t.next())this.hash_buckets_.insert(t)},n.prototype._Handle_erase=function(t,e){for(;!t.equals(e);t=t.next())this.hash_buckets_.erase(t)},n.prototype.swap=function(t){t instanceof n?(this._Swap(t),r=[t.hash_buckets_,this.hash_buckets_],this.hash_buckets_=r[0],t.hash_buckets_=r[1]):e.prototype.swap.call(this,t)
    var r},n}(t.base.MultiMap)
    t.HashMultiMap=e}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(n){function i(){var t=n.call(this)||this
        return t.data_=new r(t),t}return __extends(i,n),i.prototype.assign=function(t,e){this.clear(),this.insert(t,e)},i.prototype.clear=function(){this.data_.clear()},i.prototype.begin=function(){return this.data_.begin()},i.prototype.end=function(){return this.data_.end()},i.prototype.rbegin=function(){return this.data_.rbegin()},i.prototype.rend=function(){return this.data_.rend()},i.prototype.has=function(t){return!this.find(t).equals(this.end())},i.prototype.size=function(){return this.data_.size()},i.prototype.push=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n]
        if(0==t.length)return this.size()
        var r=new e._ArrayIterator(t,0),i=new e._ArrayIterator(t,t.length)
        return this._Insert_by_range(r,i),this.size()},i.prototype.insert=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
        if(1==e.length)return this._Insert_by_val(e[0])
        if(2==e.length&&e[0]instanceof t.Iterator){if(e[1]instanceof t.Iterator&&e[0].source()!=this&&e[1].source()!=this)return this._Insert_by_range(e[0],e[1])
            var r=void 0,i=!1
            return e[0]instanceof t.SetReverseIterator&&(i=!0,e[0]=e[0].base().prev()),r=this._Insert_by_hint(e[0],e[1]),1==i?new t.SetReverseIterator(r.next()):r}},i.prototype.erase=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
        return 1!=e.length||e[0]instanceof t.Iterator!=0&&e[0].source()==this?1==e.length?this._Erase_by_iterator(e[0]):this._Erase_by_iterator(e[0],e[1]):this._Erase_by_val(e[0])},i.prototype._Erase_by_iterator=function(e,n){void 0===n&&(n=e.next())
        var r,i=!1
        if(e instanceof t.SetReverseIterator){i=!0
            var o=n.base(),s=e.base()
            e=o,n=s}return r=this._Erase_by_range(e,n),1==i?new t.SetReverseIterator(r.next()):r},i.prototype._Erase_by_val=function(t){var e=this.find(t)
        return 1==e.equals(this.end())?0:(this._Erase_by_iterator(e),1)},i.prototype._Erase_by_range=function(t,e){var n=this.data_.erase(t,e)
        return this._Handle_erase(t,e),n},i.prototype._Swap=function(t){e=[t.data_,this.data_],this.data_=e[0],t.data_=e[1]
        var e},i}(e.Container)
        e.SetContainer=n
        var r=function(e){function n(t){var n=e.call(this)||this
            return n.associative_=t,n}return __extends(n,e),n.prototype._Create_iterator=function(e,n,r){return new t.SetIterator(this,e,n,r)},n.prototype._Set_begin=function(n){e.prototype._Set_begin.call(this,n),this.rend_=new t.SetReverseIterator(n)},n.prototype.associative=function(){return this.associative_},n.prototype.rbegin=function(){return new t.SetReverseIterator(this.end())},n.prototype.rend=function(){return this.rend_},n}(e._ListContainer)
        e._SetElementList=r}(e=t.base||(t.base={}))}(std||(std={})),function(t){var e=function(e){function n(t,n,r,i){return e.call(this,t,n,r,i)||this}return __extends(n,e),n.prototype.source=function(){return this.source_.associative()},n.prototype.prev=function(){return this.prev_},n.prototype.next=function(){return this.next_},n.prototype.advance=function(t){return e.prototype.advance.call(this,t)},n.prototype.less=function(e){return t.less(this.value,e.value)},n.prototype.equals=function(t){return this==t},n.prototype.hashCode=function(){return t.hash(this.value)},n.prototype.swap=function(t){e.prototype.swap.call(this,t)},n}(t.base._ListIteratorBase)
    t.SetIterator=e
    var n=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype._Create_neighbor=function(t){return new e(t)},e}(t.ReverseIterator)
    t.SetReverseIterator=n}(std||(std={}))
var std
!function(t){var e
    !function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e.prototype.insert=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
        return t.prototype.insert.apply(this,e)},e.prototype.merge=function(t){this.insert(t.begin(),t.end()),t.clear()},e}(t.SetContainer)
        t.MultiSet=e}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e=function(e){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i]
    var o=e.call(this)||this
    if(o.hash_buckets_=new t.base._SetHashBuckets(o),0==r.length);else if(1==r.length&&r[0]instanceof n){var s=r[0]
        o.assign(s.begin(),s.end())}else if(1==r.length&&r[0]instanceof Array){var a=r[0]
        o.rehash(a.length*t.base._Hash.RATIO),o.push.apply(o,a)}else if(2==r.length&&r[0]instanceof t.Iterator&&r[1]instanceof t.Iterator){var u=r[0],_=r[1]
        o.assign(u,_)}return o}return __extends(n,e),n.prototype.clear=function(){this.hash_buckets_.clear(),e.prototype.clear.call(this)},n.prototype.find=function(t){return this.hash_buckets_.find(t)},n.prototype.count=function(e){for(var n=t.hash(e)%this.hash_buckets_.item_size(),r=this.hash_buckets_.at(n),i=0,o=0;o<r.size();o++)t.equal_to(r.at(o).value,e)&&i++
    return i},n.prototype.begin=function(t){return void 0===t&&(t=-1),t==-1?e.prototype.begin.call(this):this.hash_buckets_.at(t).front()},n.prototype.end=function(t){return void 0===t&&(t=-1),t==-1?e.prototype.end.call(this):this.hash_buckets_.at(t).back().next()},n.prototype.rbegin=function(n){return void 0===n&&(n=-1),n==-1?e.prototype.rbegin.call(this):new t.SetReverseIterator(this.end(n))},n.prototype.rend=function(n){return void 0===n&&(n=-1),n==-1?e.prototype.rend.call(this):new t.SetReverseIterator(this.begin(n))},n.prototype.bucket_count=function(){return this.hash_buckets_.size()},n.prototype.bucket_size=function(t){return this.hash_buckets_.at(t).size()},n.prototype.max_load_factor=function(t){return void 0===t&&(t=-1),t==-1?this.size()/this.bucket_count():void this.rehash(Math.ceil(this.bucket_count()/t))},n.prototype.bucket=function(e){return t.hash(e)%this.hash_buckets_.size()},n.prototype.reserve=function(t){this.hash_buckets_.rehash(Math.ceil(t*this.max_load_factor()))},n.prototype.rehash=function(t){t<=this.bucket_count()||this.hash_buckets_.rehash(t)},n.prototype._Insert_by_val=function(t){var e=this.data_.insert(this.data_.end(),t)
    return this._Handle_insert(e,e.next()),e},n.prototype._Insert_by_hint=function(t,e){var n=this.data_.insert(t,e)
    return this._Handle_insert(n,n.next()),n},n.prototype._Insert_by_range=function(e,n){var r=this.data_.insert(this.data_.end(),e,n)
    this.size()>this.hash_buckets_.item_size()*t.base._Hash.MAX_RATIO&&this.hash_buckets_.rehash(this.size()*t.base._Hash.RATIO),this._Handle_insert(r,this.end())},n.prototype._Handle_insert=function(t,e){for(;!t.equals(e);t=t.next())this.hash_buckets_.insert(t)},n.prototype._Handle_erase=function(t,e){for(;!t.equals(e);t=t.next())this.hash_buckets_.erase(t)},n.prototype.swap=function(t){t instanceof n?(this._Swap(t),r=[t.hash_buckets_,this.hash_buckets_],this.hash_buckets_=r[0],t.hash_buckets_=r[1]):e.prototype.swap.call(this,t)
    var r},n}(t.base.MultiSet)
    t.HashMultiSet=e}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return __extends(n,e),n.prototype.count=function(t){return this.find(t).equals(this.end())?0:1},n.prototype.insert=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n]
        return e.prototype.insert.apply(this,t)},n.prototype.extract=function(e){return e instanceof t.SetIterator?this._Extract_by_iterator(e):e instanceof t.SetReverseIterator?this._Extract_by_reverse_iterator(e):this._Extract_by_key(e)},n.prototype._Extract_by_key=function(e){var n=this.find(e)
        if(1==n.equals(this.end()))throw new t.OutOfRange("No such key exists.")
        return this.erase(e),e},n.prototype._Extract_by_iterator=function(t){return 1==t.equals(this.end())||0==this.has(t.value)?this.end():(this.erase(t),t)},n.prototype._Extract_by_reverse_iterator=function(t){return this._Extract_by_iterator(t.base().next()),t},n.prototype.merge=function(t){for(var e=t.begin();!e.equals(t.end());)0==this.has(e.value)?(this.insert(e.value),e=t.erase(e)):e=e.next()},n}(e.SetContainer)
        e.UniqueSet=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e=function(e){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i]
    var o=e.call(this)||this
    if(o.hash_buckets_=new t.base._SetHashBuckets(o),0==r.length);else if(1==r.length&&r[0]instanceof n){var s=r[0]
        o.assign(s.begin(),s.end())}else if(1==r.length&&r[0]instanceof Array){var a=r[0]
        o.rehash(a.length*t.base._Hash.RATIO),o.push.apply(o,a)}else if(2==r.length&&r[0]instanceof t.Iterator&&r[1]instanceof t.Iterator){var u=r[0],_=r[1]
        o.assign(u,_)}return o}return __extends(n,e),n.prototype.clear=function(){this.hash_buckets_.clear(),e.prototype.clear.call(this)},n.prototype.find=function(t){return this.hash_buckets_.find(t)},n.prototype.begin=function(t){return void 0===t&&(t=-1),t==-1?e.prototype.begin.call(this):this.hash_buckets_.at(t).front()},n.prototype.end=function(t){return void 0===t&&(t=-1),t==-1?e.prototype.end.call(this):this.hash_buckets_.at(t).back().next()},n.prototype.rbegin=function(n){return void 0===n&&(n=-1),n==-1?e.prototype.rbegin.call(this):new t.SetReverseIterator(this.end(n))},n.prototype.rend=function(n){return void 0===n&&(n=-1),n==-1?e.prototype.rend.call(this):new t.SetReverseIterator(this.begin(n))},n.prototype.bucket_count=function(){return this.hash_buckets_.size()},n.prototype.bucket_size=function(t){return this.hash_buckets_.at(t).size()},n.prototype.max_load_factor=function(t){return void 0===t&&(t=-1),t==-1?this.size()/this.bucket_count():void this.rehash(Math.ceil(this.bucket_count()/t))},n.prototype.bucket=function(e){return t.hash(e)%this.hash_buckets_.size()},n.prototype.reserve=function(t){this.hash_buckets_.rehash(Math.ceil(t*this.max_load_factor()))},n.prototype.rehash=function(t){t<=this.bucket_count()||this.hash_buckets_.rehash(t)},n.prototype._Insert_by_val=function(e){var n=this.find(e)
    return 0==n.equals(this.end())?t.make_pair(n,!1):(this.data_.push_back(e),n=n.prev(),this._Handle_insert(n,n.next()),t.make_pair(n,!0))},n.prototype._Insert_by_hint=function(t,e){var n=this.find(e)
    return 1==n.equals(this.end())&&(n=this.data_.insert(t,e),this._Handle_insert(n,n.next())),n},n.prototype._Insert_by_range=function(e,n){for(var r=this.end().prev(),i=0;!e.equals(n);e=e.next())this.has(e.value)||(this.data_.push_back(e.value),i++)
    r=r.next(),this.size()+i>this.hash_buckets_.size()*t.base._Hash.MAX_RATIO&&this.hash_buckets_.rehash((this.size()+i)*t.base._Hash.RATIO),this._Handle_insert(r,this.end())},n.prototype._Handle_insert=function(t,e){for(;!t.equals(e);t=t.next())this.hash_buckets_.insert(t)},n.prototype._Handle_erase=function(t,e){for(;!t.equals(e);t=t.next())this.hash_buckets_.erase(t)},n.prototype.swap=function(t){t instanceof n?(this._Swap(t),r=[t.hash_buckets_,this.hash_buckets_],this.hash_buckets_=r[0],t.hash_buckets_=r[1]):e.prototype.swap.call(this,t)
    var r},n}(t.base.UniqueSet)
    t.HashSet=e}(std||(std={}))
var std
!function(t){var e=function(e){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i]
    var o=e.call(this)||this
    if(0==r.length);else if(1==r.length&&r[0]instanceof Array){var s=r[0]
        o.push.apply(o,s)}else if(1==r.length&&r[0]instanceof n){var a=r[0]
        o.assign(a.begin(),a.end())}else if(2==r.length&&r[0]instanceof t.Iterator&&r[1]instanceof t.Iterator){var u=r[0],_=r[1]
        o.assign(u,_)}else if(2==r.length&&"number"==typeof r[0]){var c=r[0],h=r[1]
        o.assign(c,h)}return o}return __extends(n,e),n.prototype._Create_iterator=function(e,n,r){return new t.ListIterator(this,e,n,r)},n.prototype._Set_begin=function(n){e.prototype._Set_begin.call(this,n),this.rend_=new t.ListReverseIterator(n)},n.prototype.assign=function(t,e){this.clear(),this.insert(this.end(),t,e)},n.prototype.rbegin=function(){return new t.ListReverseIterator(this.end())},n.prototype.rend=function(){return this.rend_},n.prototype.front=function(){return this.begin().value},n.prototype.back=function(){return this.end().prev().value},n.prototype.insert=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r]
    var i,o=!1
    return n[0]instanceof t.ListReverseIterator&&(o=!0,n[0]=n[0].base().prev()),i=e.prototype.insert.apply(this,n),1==o?new t.ListReverseIterator(i.next()):i},n.prototype.erase=function(e,n){void 0===n&&(n=e.next())
    var r,i=!1
    if(e instanceof t.ListReverseIterator){i=!0
        var o=n.base(),s=e.base()
        e=o,n=s}return r=this._Erase_by_range(e,n),1==i?new t.ListReverseIterator(r.next()):r},n.prototype.unique=function(e){void 0===e&&(e=t.equal_to)
    for(var n=this.begin().next();!n.equals(this.end());)n=1==t.equal_to(n.value,n.prev().value)?this.erase(n):n.next()},n.prototype.remove=function(e){for(var n=this.begin();!n.equals(this.end());)n=1==t.equal_to(n.value,e)?this.erase(n):n.next()},n.prototype.remove_if=function(t){for(var e=this.begin();!e.equals(this.end());)e=1==t(e.value)?this.erase(e):e.next()},n.prototype.merge=function(e,n){if(void 0===n&&(n=t.less),this!=e)for(var r=this.begin();0==e.empty();){for(var i=e.begin();!r.equals(this.end())&&1==n(r.value,i.value);)r=r.next()
    this.splice(r,e,i)}},n.prototype.splice=function(t,e,n,r){void 0===n&&(n=null),void 0===r&&(r=null),null==n?(n=e.begin(),r=e.end()):null==r&&(r=n.next()),this.insert(t,n,r),e.erase(n,r)},n.prototype.sort=function(e){void 0===e&&(e=t.less),this._Quick_sort(this.begin(),this.end().prev(),e)},n.prototype._Quick_sort=function(t,e,n){if(!t.equals(e)&&!e.equals(this.end())&&!t.equals(e.next())){var r=this._Quick_sort_partition(t,e,n)
    this._Quick_sort(t,r.prev(),n),this._Quick_sort(r.next(),e,n)}},n.prototype._Quick_sort_partition=function(t,e,n){for(var r=e.value,i=t.prev(),o=t;!o.equals(e);o=o.next())n(o.value,r)&&(i=i.equals(this.end())?t:i.next(),s=[o.value,i.value],i.value=s[0],o.value=s[1])
    return i=i.equals(this.end())?t:i.next(),a=[o.value,i.value],i.value=a[0],o.value=a[1],i
    var s,a},n.prototype.reverse=function(){for(var t=this.end().prev(),e=this.begin(),n=this.begin();!n.equals(this.end());){var r=n.next()
    i=[n.next_,n.prev_],n.prev_=i[0],n.next_=i[1],n=r}this._Set_begin(t),this.end().prev_=e,this.end().next_=t
    var i},n.prototype.swap=function(t){e.prototype.swap.call(this,t)},n}(t.base._ListContainer)
    t.List=e}(std||(std={})),function(t){var e=function(t){function e(e,n,r,i){return t.call(this,e,n,r,i)||this}return __extends(e,t),e.prototype.source=function(){return this.source_},Object.defineProperty(e.prototype,"value",{get:function(){return this.value_},set:function(t){this.value_=t},enumerable:!0,configurable:!0}),e.prototype.prev=function(){return this.prev_},e.prototype.next=function(){return this.next_},e.prototype.advance=function(e){return t.prototype.advance.call(this,e)},e.prototype.equals=function(t){return this==t},e.prototype.swap=function(e){t.prototype.swap.call(this,e)},e}(t.base._ListIteratorBase)
    t.ListIterator=e}(std||(std={})),function(t){var e=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype._Create_neighbor=function(t){return new e(t)},Object.defineProperty(e.prototype,"value",{get:function(){return this.base_.value},set:function(t){this.base_.value=t},enumerable:!0,configurable:!0}),e}(t.ReverseIterator)
    t.ListReverseIterator=e}(std||(std={}))
var std
!function(t){var e=function(){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
    if(this.container_=new t.TreeMultiSet,e.length>=1&&e[0]instanceof t.base.Container){var r=e[0]
        2==e.length&&(this.container_.tree_.compare_=e[1]),this.container_.assign(r.begin(),r.end())}else if(e.length>=1&&e[0]instanceof Array){var i=e[0]
        2==e.length&&(this.container_.tree_.compare_=e[1]),(a=this.container_).push.apply(a,i)}else if(e.length>=2&&e[0]instanceof t.Iterator&&e[1]instanceof t.Iterator){var o=e[0],s=e[1]
        2==e.length&&(this.container_.tree_.compare_=e[2]),this.container_.assign(o,s)}else 1==e.length&&(this.container_.tree_.compare_=e[0])
    var a}return e.prototype.size=function(){return this.container_.size()},e.prototype.empty=function(){return this.container_.empty()},e.prototype.top=function(){return this.container_.begin().value},e.prototype.push=function(t){this.container_.insert(t)},e.prototype.pop=function(){this.container_.erase(this.container_.begin())},e.prototype.swap=function(t){this.container_.swap(t.container_)},e}()
    t.PriorityQueue=e}(std||(std={}))
var std
!function(t){var e=function(){function e(e){void 0===e&&(e=null),this.container_=new t.List,null!=e&&this.container_.assign(e.container_.begin(),e.container_.end())}return e.prototype.size=function(){return this.container_.size()},e.prototype.empty=function(){return this.container_.empty()},e.prototype.front=function(){return this.container_.front()},e.prototype.back=function(){return this.container_.back()},e.prototype.push=function(t){this.container_.push_back(t)},e.prototype.pop=function(){this.container_.pop_front()},e.prototype.swap=function(t){this.container_.swap(t.container_)},e}()
    t.Queue=e}(std||(std={}))
var std
!function(t){var e=function(){function e(e){void 0===e&&(e=null),this.container_=new t.List,null!=e&&this.container_.assign(e.container_.begin(),e.container_.end())}return e.prototype.size=function(){return this.container_.size()},e.prototype.empty=function(){return this.container_.empty()},e.prototype.top=function(){return this.container_.back()},e.prototype.push=function(t){this.container_.push_back(t)},e.prototype.pop=function(){this.container_.pop_back()},e.prototype.swap=function(t){this.container_.swap(t.container_)},e}()
    t.Stack=e}(std||(std={}))
var std
!function(t){var e
    !function(t){var e=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=null),this.assign(t,e)}return t.prototype.assign=function(t,e){this.category_=e,this.value_=t},t.prototype.clear=function(){this.value_=0},t.prototype.category=function(){return this.category_},t.prototype.value=function(){return this.value_},t.prototype.message=function(){return null==this.category_||0==this.value_?"":this.category_.message(this.value_)},t.prototype.default_error_condition=function(){return null==this.category_||0==this.value_?null:this.category_.default_error_condition(this.value_)},t.prototype.to_bool=function(){return 0!=this.value_},t}()
        t.ErrorInstance=e}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
    return t.call(this,"")||this}return __extends(e,t),e.prototype.code=function(){return this.code_},e}(t.RuntimeError)
    t.SystemError=e}(std||(std={})),function(t){var e=function(){function e(){}return e.prototype.default_error_condition=function(e){return new t.ErrorCondition(e,this)},e.prototype.equivalent=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
    if(e[1]instanceof t.ErrorCondition){var r=e[0],i=e[1]
        return t.equal_to(this.default_error_condition(r),i)}var o=e[0],s=e[1]
    return t.equal_to(this,o.category())&&o.value()==s},e}()
    t.ErrorCategory=e}(std||(std={})),function(t){var e=function(t){function e(e,n){return void 0===e&&(e=0),void 0===n&&(n=null),t.call(this,e,n)||this}return __extends(e,t),e}(t.base.ErrorInstance)
    t.ErrorCondition=e}(std||(std={})),function(t){var e=function(t){function e(e,n){return void 0===e&&(e=0),void 0===n&&(n=null),t.call(this,e,n)||this}return __extends(e,t),e}(t.base.ErrorInstance)
    t.ErrorCode=e}(std||(std={}))
var std
!function(t){var e=function(e){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i]
    var o=e.call(this)||this,s=t.less,a=null
    if(r.length>=1&&r[0]instanceof n){var u=r[0]
        2==r.length&&(s=r[1]),a=o.assign.bind(o,u.begin(),u.end())}else if(r.length>=1&&r[0]instanceof Array){var _=r[0]
        2==r.length&&(s=r[1]),a=(l=o.push).bind.apply(l,[o].concat(_))}else if(r.length>=2&&r[0]instanceof t.Iterator&&r[1]instanceof t.Iterator){var c=r[0],h=r[1]
        3==r.length&&(s=r[2]),a=o.assign.bind(o,c,h)}else 1==r.length&&(s=r[0])
    return o.tree_=new t.base._UniqueMapTree(o,s),null!=a&&a(),o
    var l}return __extends(n,e),n.prototype.clear=function(){e.prototype.clear.call(this),this.tree_.clear()},n.prototype.find=function(e){var n=this.tree_.find_by_key(e)
    return null==n||0==t.equal_to(n.value.first,e)?this.end():n.value},n.prototype.key_comp=function(){return this.tree_.key_comp()},n.prototype.value_comp=function(){return this.tree_.value_comp()},n.prototype.lower_bound=function(t){return this.tree_.lower_bound(t)},n.prototype.upper_bound=function(t){return this.tree_.upper_bound(t)},n.prototype.equal_range=function(t){return this.tree_.equal_range(t)},n.prototype._Insert_by_pair=function(e){var n=this.lower_bound(e.first)
    return!n.equals(this.end())&&t.equal_to(n.first,e.first)?t.make_pair(n,!1):(n=this.data_.insert(n,e),this._Handle_insert(n,n.next()),t.make_pair(n,!0))},n.prototype._Insert_by_hint=function(e,n){var r=n.first,i=e.prev(),o=new t.Vector
    if(!i.equals(this.end())){if(t.equal_to(i.first,r))return i
        o.push_back(i.first)}if(o.push_back(r),!e.equals(this.end())){if(t.equal_to(e.first,r))return e
        o.push_back(e.first)}var s
    return t.is_sorted(o.begin(),o.end(),this.key_comp())?(s=this.data_.insert(e,n),this._Handle_insert(s,s.next())):s=this._Insert_by_pair(n).first,s},n.prototype._Insert_by_range=function(e,n){for(;!e.equals(n);e=e.next())this._Insert_by_pair(t.make_pair(e.value.first,e.value.second))},n.prototype._Handle_insert=function(t,e){this.tree_.insert(t)},n.prototype._Handle_erase=function(t,e){for(;!t.equals(e);t=t.next())this.tree_.erase(t)},n.prototype.swap=function(t){t instanceof n&&this.key_comp()==t.key_comp()?(this._Swap(t),r=[t.tree_,this.tree_],this.tree_=r[0],t.tree_=r[1]):e.prototype.swap.call(this,t)
    var r},n}(t.base.UniqueMap)
    t.TreeMap=e}(std||(std={}))
var std
!function(t){var e=function(e){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i]
    var o=e.call(this)||this,s=t.less,a=null
    if(r.length>=1&&r[0]instanceof n){var u=r[0]
        2==r.length&&(s=r[1]),a=o.assign.bind(o,u.begin(),u.end())}else if(r.length>=1&&r[0]instanceof Array){var _=r[0]
        2==r.length&&(s=r[1]),a=(l=o.push).bind.apply(l,[o].concat(_))}else if(r.length>=2&&r[0]instanceof t.Iterator&&r[1]instanceof t.Iterator){var c=r[0],h=r[1]
        3==r.length&&(s=r[2]),a=o.assign.bind(o,c,h)}else 1==r.length&&(s=r[0])
    return o.tree_=new t.base._MultiMapTree(o,s),null!=a&&a(),o
    var l}return __extends(n,e),n.prototype.clear=function(){e.prototype.clear.call(this),this.tree_.clear()},n.prototype.find=function(e){var n=this.tree_.find_by_key(e)
    return null==n||0==t.equal_to(n.value.first,e)?this.end():n.value},n.prototype.count=function(e){for(var n=this.find(e),r=0;!n.equals(this.end())&&t.equal_to(n.first,e);n=n.next())r++
    return r},n.prototype.key_comp=function(){return this.tree_.key_comp()},n.prototype.value_comp=function(){return this.tree_.value_comp()},n.prototype.lower_bound=function(t){return this.tree_.lower_bound(t)},n.prototype.upper_bound=function(t){return this.tree_.upper_bound(t)},n.prototype.equal_range=function(t){return this.tree_.equal_range(t)},n.prototype._Insert_by_pair=function(t){var e=this.upper_bound(t.first)
    return e=this.data_.insert(e,t),this._Handle_insert(e,e.next()),e},n.prototype._Insert_by_hint=function(e,n){var r=n.first,i=e.prev(),o=new t.Vector
    i.equals(this.end())||t.equal_to(i.first,r)||o.push_back(i.first),o.push_back(r),e.equals(this.end())||t.equal_to(e.first,r)||o.push_back(e.first)
    var s
    return t.is_sorted(o.begin(),o.end(),this.key_comp())?(s=this.data_.insert(e,n),this._Handle_insert(s,s.next())):s=this._Insert_by_pair(n),s},n.prototype._Insert_by_range=function(e,n){for(;!e.equals(n);e=e.next())this._Insert_by_pair(t.make_pair(e.value.first,e.value.second))},n.prototype._Handle_insert=function(t,e){this.tree_.insert(t)},n.prototype._Handle_erase=function(t,e){for(;!t.equals(e);t=t.next())this.tree_.erase(t)},n.prototype.swap=function(t){t instanceof n&&this.key_comp()==t.key_comp()?(this._Swap(t),r=[t.tree_,this.tree_],this.tree_=r[0],t.tree_=r[1]):e.prototype.swap.call(this,t)
    var r},n}(t.base.MultiMap)
    t.TreeMultiMap=e}(std||(std={}))
var std
!function(t){var e=function(e){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i]
    var o=e.call(this)||this,s=t.less,a=null
    if(r.length>=1&&r[0]instanceof n){var u=r[0]
        2==r.length&&(s=r[1]),a=o.assign.bind(o,u.begin(),u.end())}else if(r.length>=1&&r[0]instanceof Array){var _=r[0]
        2==r.length&&(s=r[1]),a=(l=o.push).bind.apply(l,[o].concat(_))}else if(r.length>=2&&r[0]instanceof t.Iterator&&r[1]instanceof t.Iterator){var c=r[0],h=r[1]
        3==r.length&&(s=r[2]),a=o.assign.bind(o,c,h)}else 1==r.length&&(s=r[0])
    return o.tree_=new t.base._MultiSetTree(o,s),null!=a&&a(),o
    var l}return __extends(n,e),n.prototype.clear=function(){e.prototype.clear.call(this),this.tree_.clear()},n.prototype.find=function(e){var n=this.tree_.find_by_val(e)
    return null==n||0==t.equal_to(n.value.value,e)?this.end():n.value},n.prototype.count=function(e){for(var n=this.find(e),r=0;!n.equals(this.end())&&t.equal_to(n.value,e);n=n.next())r++
    return r},n.prototype.key_comp=function(){return this.tree_.key_comp()},n.prototype.value_comp=function(){return this.tree_.key_comp()},n.prototype.lower_bound=function(t){return this.tree_.lower_bound(t)},n.prototype.upper_bound=function(t){return this.tree_.upper_bound(t)},n.prototype.equal_range=function(t){return this.tree_.equal_range(t)},n.prototype._Insert_by_val=function(t){var e=this.upper_bound(t)
    return e=this.data_.insert(e,t),this._Handle_insert(e,e.next()),e},n.prototype._Insert_by_hint=function(e,n){var r=e.prev(),i=new t.Vector
    r.equals(this.end())||t.equal_to(r.value,n)||i.push_back(r.value),i.push_back(n),e.equals(this.end())||t.equal_to(e.value,n)||i.push_back(e.value)
    var o
    return t.is_sorted(i.begin(),i.end(),this.key_comp())?(o=this.data_.insert(e,n),this._Handle_insert(o,o.next())):o=this._Insert_by_val(n),o},n.prototype._Insert_by_range=function(t,e){for(;!t.equals(e);t=t.next())this._Insert_by_val(t.value)},n.prototype._Handle_insert=function(t,e){this.tree_.insert(t)},n.prototype._Handle_erase=function(t,e){for(;!t.equals(e);t=t.next())this.tree_.erase(t)},n.prototype.swap=function(t){t instanceof n&&this.key_comp()==t.key_comp()?(this._Swap(t),r=[t.tree_,this.tree_],this.tree_=r[0],t.tree_=r[1]):e.prototype.swap.call(this,t)
    var r},n}(t.base.MultiSet)
    t.TreeMultiSet=e}(std||(std={}))
var std
!function(t){var e=function(e){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i]
    var o=e.call(this)||this,s=t.less,a=null
    if(r.length>=1&&r[0]instanceof n){var u=r[0]
        2==r.length&&(s=r[1]),a=o.assign.bind(o,u.begin(),u.end())}else if(r.length>=1&&r[0]instanceof Array){var _=r[0]
        2==r.length&&(s=r[1]),a=(l=o.push).bind.apply(l,[o].concat(_))}else if(r.length>=2&&r[0]instanceof t.Iterator&&r[1]instanceof t.Iterator){var c=r[0],h=r[1]
        3==r.length&&(s=r[2]),a=o.assign.bind(o,c,h)}else 1==r.length&&(s=r[0])
    return o.tree_=new t.base._UniqueSetTree(o,s),null!=a&&a(),o
    var l}return __extends(n,e),n.prototype.clear=function(){e.prototype.clear.call(this),this.tree_.clear()},n.prototype.find=function(e){var n=this.tree_.find_by_val(e)
    return null==n||0==t.equal_to(n.value.value,e)?this.end():n.value},n.prototype.key_comp=function(){return this.tree_.key_comp()},n.prototype.value_comp=function(){return this.tree_.key_comp()},n.prototype.lower_bound=function(t){return this.tree_.lower_bound(t)},n.prototype.upper_bound=function(t){return this.tree_.upper_bound(t)},n.prototype.equal_range=function(t){return this.tree_.equal_range(t)},n.prototype._Insert_by_val=function(e){var n=this.lower_bound(e)
    return!n.equals(this.end())&&t.equal_to(n.value,e)?t.make_pair(n,!1):(n=this.data_.insert(n,e),this._Handle_insert(n,n.next()),t.make_pair(n,!0))},n.prototype._Insert_by_hint=function(e,n){var r=e.prev(),i=new t.Vector
    if(!r.equals(this.end())){if(t.equal_to(r.value,n))return r
        i.push_back(r.value)}if(i.push_back(n),!e.equals(this.end())){if(t.equal_to(e.value,n))return e
        i.push_back(e.value)}var o
    return t.is_sorted(i.begin(),i.end(),this.key_comp())?(o=this.data_.insert(e,n),this._Handle_insert(o,o.next())):o=this._Insert_by_val(n).first,o},n.prototype._Insert_by_range=function(t,e){for(;!t.equals(e);t=t.next())this._Insert_by_val(t.value)},n.prototype._Handle_insert=function(t,e){this.tree_.insert(t)},n.prototype._Handle_erase=function(t,e){for(;!t.equals(e);t=t.next())this.tree_.erase(t)},n.prototype.swap=function(t){t instanceof n&&this.key_comp()==t.key_comp()?(this._Swap(t),r=[t.tree_,this.tree_],this.tree_=r[0],t.tree_=r[1]):e.prototype.swap.call(this,t)
    var r},n}(t.base.UniqueSet)
    t.TreeSet=e}(std||(std={}))
var std
!function(t){function e(){return"object"==typeof process&&"object"==typeof process.versions&&"undefined"!=typeof process.versions.node}function n(t,e){return new r(t,e)}t.is_node=e
    var r=function(){function e(t,e){this.first=t,this.second=e}return e.prototype.equals=function(e){return t.equal_to(this.first,e.first)&&t.equal_to(this.second,e.second)},e.prototype.less=function(e){return 0==t.equal_to(this.first,e.first)?t.less(this.first,e.first):t.less(this.second,e.second)},e}()
    t.Pair=r,t.make_pair=n}(std||(std={}))
var std
!function(t){var e=function(e){function n(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r]
    var i=e.call(this)||this
    if(i.data_=[],i.begin_=new t.VectorIterator(i,0),i.end_=new t.VectorIterator(i,-1),i.rend_=new t.VectorReverseIterator(i.begin_),0==n.length);else if(1==n.length&&n[0]instanceof Array){var o=n[0]
        i.data_=o.slice()}else if(1==n.length&&"number"==typeof n[0]){var s=n[0]
        i.data_.length=s}else if(2==n.length&&"number"==typeof n[0]){var a=n[0],u=n[1]
        i.assign(a,u)}else if(2==n.length&&n[0]instanceof t.Iterator&&n[1]instanceof t.Iterator){var _=n[0],c=n[1]
        i.assign(_,c)}return i}return __extends(n,e),n.prototype.assign=function(t,e){this.clear(),this.insert(this.end(),t,e)},n.prototype.clear=function(){this.erase(this.begin(),this.end())},n.prototype.begin=function(){return 1==this.empty()?this.end_:this.begin_},n.prototype.end=function(){return this.end_},n.prototype.rbegin=function(){return new t.VectorReverseIterator(this.end_)},n.prototype.rend=function(){return 1==this.empty()?new t.VectorReverseIterator(this.end_):this.rend_},n.prototype.size=function(){return this.data_.length},n.prototype.empty=function(){return 0==this.size()},n.prototype.at=function(e){if(e<this.size())return this.data_[e]
    throw new t.OutOfRange("Target index is greater than Vector's size.")},n.prototype.set=function(e,n){if(e>=this.size())throw new t.OutOfRange("Target index is greater than Vector's size.")
    var r=this.data_[e]
    return this.data_[e]=n,r},n.prototype.front=function(){return this.at(0)},n.prototype.back=function(){return this.at(this.size()-1)},n.prototype.data=function(){return this.data_},n.prototype.push=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]
    return(n=this.data_).push.apply(n,t)
    var n},n.prototype.push_back=function(t){this.data_.push(t)},n.prototype.insert=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
    var r,i=!1
    return e[0]instanceof t.VectorReverseIterator&&(i=!0,e[0]=e[0].base().prev()),r=2==e.length?this._Insert_by_val(e[0],e[1]):3==e.length&&"number"==typeof e[1]?this._Insert_by_repeating_val(e[0],e[1],e[2]):this._Insert_by_range(e[0],e[1],e[2]),1==i?new t.VectorReverseIterator(r.next()):r},n.prototype._Insert_by_val=function(t,e){return this._Insert_by_repeating_val(t,1,e)},n.prototype._Insert_by_repeating_val=function(e,n,r){var i=new t.base._Repeater(0,r),o=new t.base._Repeater(n)
    return this._Insert_by_range(e,i,o)},n.prototype._Insert_by_range=function(t,e,n){if(t.index()==-1){for(;!e.equals(n);e=e.next())this.data_.push(e.value)
    return this.begin()}for(var r=this.data_.splice(t.index()),i=0;!e.equals(n);e=e.next())this.data_.push(e.value),i++
    return(o=this.data_).push.apply(o,r),t
    var o},n.prototype.pop_back=function(){this.data_.pop()},n.prototype.erase=function(e,n){void 0===n&&(n=e.next())
    var r,i=!1
    if(e instanceof t.VectorReverseIterator){i=!0
        var o=n.base(),s=e.base()
        e=o,n=s}return r=this._Erase_by_range(e,n),1==i?new t.VectorReverseIterator(r.next()):r},n.prototype._Erase_by_range=function(t,e){return t.index()==-1?t:e.index()==-1?(this.data_.splice(t.index()),this.end()):(this.data_.splice(t.index(),e.index()-t.index()),t)},n.prototype.swap=function(t){t instanceof n?(r=[t.data_,this.data_],this.data_=r[0],t.data_=r[1]):e.prototype.swap.call(this,t)
    var r},n}(t.base.Container)
    t.Vector=e}(std||(std={})),function(t){var e=function(t){function e(e,n){var r=t.call(this,e)||this
    return r.index_=n,r}return __extends(e,t),e.prototype.source=function(){return this.source_},e.prototype.index=function(){return this.index_},Object.defineProperty(e.prototype,"value",{get:function(){return this.source().at(this.index_)},set:function(t){this.source().set(this.index_,t)},enumerable:!0,configurable:!0}),e.prototype.prev=function(){return this.index_==-1?new e(this.source(),this.source_.size()-1):this.index_-1<0?this.source().end():new e(this.source(),this.index_-1)},e.prototype.next=function(){return this.index_>=this.source_.size()-1?this.source().end():new e(this.source(),this.index_+1)},e.prototype.advance=function(t){var n
    return n=t<0&&this.index_==-1?this.source_.size()+t:this.index_+t,n<0||n>=this.source_.size()?this.source().end():new e(this.source(),n)},e.prototype.equals=function(e){return t.prototype.equals.call(this,e)&&this.index_==e.index_},e.prototype.swap=function(t){e=[t.value,this.value],this.value=e[0],t.value=e[1]
    var e},e}(t.Iterator)
    t.VectorIterator=e}(std||(std={})),function(t){var e=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype._Create_neighbor=function(t){return new e(t)},e.prototype.index=function(){return this.base_.index()},Object.defineProperty(e.prototype,"value",{get:function(){return this.base_.value},set:function(t){this.base_.value=t},enumerable:!0,configurable:!0}),e}(t.ReverseIterator)
    t.VectorReverseIterator=e}(std||(std={}))
var std
!function(t){var e
    !function(e){var n
        !function(t){t[t.MIN_SIZE=10]="MIN_SIZE",t[t.RATIO=1]="RATIO",t[t.MAX_RATIO=2]="MAX_RATIO"}(n=e._Hash||(e._Hash={}))
        var r=function(){function e(){this.clear()}return e.prototype.rehash=function(e){e<n.MIN_SIZE&&(e=n.MIN_SIZE)
            var r=this.buckets_
            this.buckets_=new t.Vector
            for(var i=0;i<e;i++)this.buckets_.push_back(new t.Vector)
            for(var i=0;i<r.size();i++)for(var o=0;o<r.at(i).size();o++){var s=r.at(i).at(o),a=this.buckets_.at(this.hash_index(s))
                a.push_back(s),this.item_size_++}},e.prototype.clear=function(){this.buckets_=new t.Vector,this.item_size_=0
            for(var e=0;e<n.MIN_SIZE;e++)this.buckets_.push_back(new t.Vector)},e.prototype.size=function(){return this.buckets_.size()},e.prototype.item_size=function(){return this.item_size_},e.prototype.capacity=function(){return this.buckets_.size()*n.MAX_RATIO},e.prototype.at=function(t){return this.buckets_.at(t)},e.prototype.hash_index=function(e){return t.hash(e)%this.buckets_.size()},e.prototype.insert=function(t){this.buckets_.at(this.hash_index(t)).push_back(t),++this.item_size_>this.capacity()&&this.rehash(this.item_size_*n.RATIO)},e.prototype.erase=function(t){for(var e=this.buckets_.at(this.hash_index(t)),n=0;n<e.size();n++)if(e.at(n)==t){e.erase(e.begin().advance(n)),this.item_size_--
            break}},e}()
        e._HashBuckets=r}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(e){function n(t){var n=e.call(this)||this
        return n.map_=t,n}return __extends(n,e),n.prototype.find=function(e){for(var n=t.hash(e)%this.size(),r=this.at(n),i=0;i<r.size();i++)if(t.equal_to(r.at(i).first,e))return r.at(i)
        return this.map_.end()},n}(e._HashBuckets)
        e._MapHashBuckets=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(e){function n(t){var n=e.call(this)||this
        return n.set_=t,n}return __extends(n,e),n.prototype.find=function(e){for(var n=t.hash(e)%this.size(),r=this.at(n),i=0;i<r.size();i++)if(t.equal_to(r.at(i).value,e))return r.at(i)
        return this.set_.end()},n}(e._HashBuckets)
        e._SetHashBuckets=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(t){function e(e,n){var r=t.call(this,null)||this
        return r.data_=e,r.index_=n,r}return __extends(e,t),e.prototype.source=function(){return null},e.prototype.index=function(){return this.index_},Object.defineProperty(e.prototype,"value",{get:function(){return this.data_[this.index_]},enumerable:!0,configurable:!0}),e.prototype.prev=function(){return this.index_--,this},e.prototype.next=function(){return this.index_++,this},e.prototype.advance=function(t){return this.index_+=t,this},e.prototype.equals=function(t){return this.data_==t.data_&&this.index_==t.index_},e.prototype.swap=function(t){e=[t.data_,this.data_],this.data_=e[0],t.data_=e[1],n=[t.index_,this.index_],this.index_=n[0],t.index_=n[1]
        var e,n},e}(t.Iterator)
        e._ArrayIterator=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(t){function e(e,n){void 0===n&&(n=null)
        var r=t.call(this,null)||this
        return r.index_=e,r.value_=n,r}return __extends(e,t),e.prototype.source=function(){return null},e.prototype.index=function(){return this.index_},Object.defineProperty(e.prototype,"value",{get:function(){return this.value_},enumerable:!0,configurable:!0}),e.prototype.prev=function(){return this.index_--,this},e.prototype.next=function(){return this.index_++,this},e.prototype.advance=function(t){return this.index_+=t,this},e.prototype.equals=function(t){return this.index_==t.index_},e.prototype.swap=function(t){e=[t.index_,this.index_],this.index_=e[0],t.index_=e[1]
        var e},e}(t.Iterator)
        e._Repeater=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(t){var e
        !function(t){t[t.BLACK=0]="BLACK",t[t.RED=1]="RED"}(e=t._Color||(t._Color={}))}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(){function n(e){void 0===e&&(e=t.less),this.root_=null,this.compare_=e}return n.prototype.clear=function(){this.root_=null},n.prototype.root=function(){return this.root_},n.prototype.find=function(e){if(null==this.root_)return null
        for(var n=this.root_;;){var r=null
            if(t.equal_to(e,n.value))break
            if(r=this.compare_(e,n.value)?n.left:n.right,null==r)break
            n=r}return n},n.prototype._Fetch_maximum=function(t){for(;null!=t.right;)t=t.right
        return t},n.prototype.insert=function(t){var n=this.find(t),r=new e._XTreeNode(t,e._Color.RED)
        null==n?this.root_=r:(r.parent=n,this.compare_(r.value,n.value)?n.left=r:n.right=r),this._Insert_case1(r)},n.prototype._Insert_case1=function(t){null==t.parent?t.color=e._Color.BLACK:this._Insert_case2(t)},n.prototype._Insert_case2=function(t){this._Fetch_color(t.parent)!=e._Color.BLACK&&this._Insert_case3(t)},n.prototype._Insert_case3=function(t){this._Fetch_color(t.uncle)==e._Color.RED?(t.parent.color=e._Color.BLACK,t.uncle.color=e._Color.BLACK,t.grandParent.color=e._Color.RED,this._Insert_case1(t.grandParent)):this._Insert_case4(t)},n.prototype._Insert_case4=function(t){t==t.parent.right&&t.parent==t.grandParent.left?(this._Rotate_left(t.parent),t=t.left):t==t.parent.left&&t.parent==t.grandParent.right&&(this._Rotate_right(t.parent),t=t.right),this._Insert_case5(t)},n.prototype._Insert_case5=function(t){t.parent.color=e._Color.BLACK,t.grandParent.color=e._Color.RED,t==t.parent.left&&t.parent==t.grandParent.left?this._Rotate_right(t.grandParent):this._Rotate_left(t.grandParent)},n.prototype.erase=function(n){var r=this.find(n)
        if(null!=r&&0!=t.equal_to(n,r.value)){if(null!=r.left&&null!=r.right){var i=this._Fetch_maximum(r.left)
            r.value=i.value,r=i}var o=null==r.right?r.left:r.right
            this._Fetch_color(r)==e._Color.BLACK&&(r.color=this._Fetch_color(o),this._Erase_case1(r)),this._Replace_node(r,o)}},n.prototype._Erase_case1=function(t){null!=t.parent&&this._Erase_case2(t)},n.prototype._Erase_case2=function(t){this._Fetch_color(t.sibling)==e._Color.RED&&(t.parent.color=e._Color.RED,t.sibling.color=e._Color.BLACK,t==t.parent.left?this._Rotate_left(t.parent):this._Rotate_right(t.parent)),this._Erase_case3(t)},n.prototype._Erase_case3=function(t){this._Fetch_color(t.parent)==e._Color.BLACK&&this._Fetch_color(t.sibling)==e._Color.BLACK&&this._Fetch_color(t.sibling.left)==e._Color.BLACK&&this._Fetch_color(t.sibling.right)==e._Color.BLACK?(t.sibling.color=e._Color.RED,this._Erase_case1(t.parent)):this._Erase_case4(t)},n.prototype._Erase_case4=function(t){this._Fetch_color(t.parent)==e._Color.RED&&null!=t.sibling&&this._Fetch_color(t.sibling)==e._Color.BLACK&&this._Fetch_color(t.sibling.left)==e._Color.BLACK&&this._Fetch_color(t.sibling.right)==e._Color.BLACK?(t.sibling.color=e._Color.RED,t.parent.color=e._Color.BLACK):this._Erase_case5(t)},n.prototype._Erase_case5=function(t){t==t.parent.left&&null!=t.sibling&&this._Fetch_color(t.sibling)==e._Color.BLACK&&this._Fetch_color(t.sibling.left)==e._Color.RED&&this._Fetch_color(t.sibling.right)==e._Color.BLACK?(t.sibling.color=e._Color.RED,t.sibling.left.color=e._Color.BLACK,this._Rotate_right(t.sibling)):t==t.parent.right&&null!=t.sibling&&this._Fetch_color(t.sibling)==e._Color.BLACK&&this._Fetch_color(t.sibling.left)==e._Color.BLACK&&this._Fetch_color(t.sibling.right)==e._Color.RED&&(t.sibling.color=e._Color.RED,t.sibling.right.color=e._Color.BLACK,this._Rotate_left(t.sibling))},n.prototype._Erase_case6=function(t){t.sibling.color=this._Fetch_color(t.parent),t.parent.color=e._Color.BLACK,t==t.parent.left?(t.sibling.right.color=e._Color.BLACK,this._Rotate_left(t.parent)):(t.sibling.left.color=e._Color.BLACK,this._Rotate_right(t.parent))},n.prototype._Rotate_left=function(t){var e=t.right
        this._Replace_node(t,e),t.right=e.left,null!=e.left&&(e.left.parent=t),e.left=t,t.parent=e},n.prototype._Rotate_right=function(t){var e=t.left
        this._Replace_node(t,e),t.left=e.right,null!=e.right&&(e.right.parent=t),e.right=t,t.parent=e},n.prototype._Replace_node=function(t,e){null==t.parent?this.root_=e:t==t.parent.left?t.parent.left=e:t.parent.right=e,null!=e&&(e.parent=t.parent)},n.prototype._Fetch_color=function(t){return null==t?e._Color.BLACK:t.color},n}()
        e._XTree=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(e){function n(t,n,r){var i=e.call(this,r)||this
        return i.map_=t,i.key_compare_=n,i.value_compare_=function(t,e){return n(t.first,e.first)},i}return __extends(n,e),n.prototype.lower_bound=function(t){var e=this.find_by_key(t)
        return null==e?this.map().end():this.key_comp()(e.value.first,t)?e.value.next():e.value},n.prototype.equal_range=function(e){return t.make_pair(this.lower_bound(e),this.upper_bound(e))},n.prototype.map=function(){return this.map_},n.prototype.key_comp=function(){return this.key_compare_},n.prototype.value_comp=function(){return this.value_compare_},n}(e._XTree)
        e._MapTree=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(e){function n(n,r){return e.call(this,n,r,function(e,n){return t.equal_to(e.first,n.first)?e.__get_m_iUID()<n.__get_m_iUID():r(e.first,n.first)})||this}return __extends(n,e),n.prototype.insert=function(t){t.__get_m_iUID(),e.prototype.insert.call(this,t)},n.prototype.find_by_key=function(e){var n=this.root_
        if(null==n)return null
        for(var r=null;;){var i=null
            if(t.equal_to(e,n.value.first)?(r=n,i=n.left):i=this.key_comp()(e,n.value.first)?n.left:n.right,null==i)break
            n=i}return null!=r?r:n},n.prototype.upper_bound=function(e){var n=this.root_
        if(null==n)return this.map().end()
        for(var r=null;;){var i=null
            if(t.equal_to(e,n.value.first)?(r=n,i=n.right):i=this.key_comp()(e,n.value.first)?n.left:n.right,null==i)break
            n=i}if(null!=r)return r.value.next()
        var o=n.value
        return this.key_comp()(o.first,e)||t.equal_to(o.first,e)?o.next():o},n}(e._MapTree)
        e._MultiMapTree=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(e){function n(t,n,r){var i=e.call(this,r)||this
        return i.set_=t,i.key_comp_=n,i}return __extends(n,e),n.prototype.lower_bound=function(t){var e=this.find_by_val(t)
        return null==e?this.set_.end():this.key_comp()(e.value.value,t)?e.value.next():e.value},n.prototype.equal_range=function(e){return t.make_pair(this.lower_bound(e),this.upper_bound(e))},n.prototype.set=function(){return this.set_},n.prototype.key_comp=function(){return this.key_comp_},n.prototype.value_comp=function(){return this.key_comp_},n}(e._XTree)
        e._SetTree=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(e){function n(n,r){return e.call(this,n,r,function(e,n){return t.equal_to(e.value,n.value)?e.__get_m_iUID()<n.__get_m_iUID():r(e.value,n.value)})||this}return __extends(n,e),n.prototype.find_by_val=function(e){var n=this.root_
        if(null==n)return null
        for(var r=null;;){var i=n.value,o=null
            if(t.equal_to(e,i.value)?(r=n,o=n.left):o=this.key_comp()(e,i.value)?n.left:n.right,null==o)break
            n=o}return null!=r?r:n},n.prototype.upper_bound=function(e){var n=this.root_
        if(null==n)return this.set().end()
        for(var r=null;;){var i=null
            if(t.equal_to(e,n.value.value)?(r=n,i=n.right):i=this.key_comp()(e,n.value.value)?n.left:n.right,null==i)break
            n=i}if(null!=r)return r.value.next()
        var o=n.value
        return t.equal_to(o.value,e)||this.key_comp()(o.value,e)?o.next():o},n}(e._SetTree)
        e._MultiSetTree=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(e){function n(t,n){return e.call(this,t,n,function(t,e){return n(t.first,e.first)})||this}return __extends(n,e),n.prototype.find_by_key=function(e){var n=this.root_
        if(null==n)return null
        for(;;){var r=n.value,i=null
            if(t.equal_to(e,r.first))break
            if(i=this.key_comp()(e,r.first)?n.left:n.right,null==i)break
            n=i}return n},n.prototype.upper_bound=function(e){var n=this.find_by_key(e)
        if(null==n)return this.map().end()
        var r=n.value
        return t.equal_to(r.first,e)||this.key_comp()(r.first,e)?r.next():r},n}(e._MapTree)
        e._UniqueMapTree=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(e){var n=function(e){function n(t,n){return e.call(this,t,n,function(t,e){return n(t.value,e.value)})||this}return __extends(n,e),n.prototype.find_by_val=function(e){var n=this.root_
        if(null==n)return null
        for(;;){var r=n.value,i=null
            if(t.equal_to(e,r.value))break
            if(i=this.key_comp()(e,r.value)?n.left:n.right,null==i)break
            n=i}return n},n.prototype.upper_bound=function(e){var n=this.find_by_val(e)
        if(null==n)return this.set().end()
        var r=n.value
        return t.equal_to(r.value,e)||this.key_comp()(r.value,e)?r.next():r},n}(e._SetTree)
        e._UniqueSetTree=n}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){var e
    !function(t){var e=function(){function t(e,n){this.uid=++t.sequence,this.value=e,this.color=n,this.parent=null,this.left=null,this.right=null}return Object.defineProperty(t.prototype,"grandParent",{get:function(){return this.parent.parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sibling",{get:function(){return this==this.parent.left?this.parent.right:this.parent.left},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"uncle",{get:function(){return this.parent.sibling},enumerable:!0,configurable:!0}),t}()
        e.sequence=0,t._XTreeNode=e}(e=t.base||(t.base={}))}(std||(std={}))
var std
!function(t){t.vector=t.Vector,t.list=t.List,t.deque=t.Deque,t.stack=t.Stack,t.queue=t.Queue,t.priority_queue=t.PriorityQueue,t.set=t.TreeSet,t.multiset=t.TreeMultiSet,t.unordered_set=t.HashSet,t.unordered_multiset=t.HashMultiSet,t.map=t.TreeMap,t.multimap=t.TreeMultiMap,t.unordered_map=t.HashMap,t.unordered_multimap=t.HashMultiMap,t.exception=t.Exception,t.logic_error=t.LogicError,t.domain_error=t.DomainError,t.invalid_argument=t.InvalidArgument,t.length_error=t.LengthError,t.out_of_range=t.OutOfRange,t.runtime_error=t.RuntimeError,t.overflow_error=t.OverflowError,t.underflow_error=t.UnderflowError,t.range_error=t.RangeError,t.system_error=t.SystemError,t.error_category=t.ErrorCategory,t.error_condition=t.ErrorCondition,t.error_code=t.ErrorCode}(std||(std={}))
try{module.exports=std}catch(t){}


var print = function (elem) {
    console.log(elem);
};

var toInt = function (elem) {
    return parseInt(elem, 10);
};
var toIntArr = function (line) {
    var intArray = line.split(' ').map(toInt);
    if (intArray.length === 1) {
        return intArray[0];
    } else {
        return intArray;
    }
};
var inputs = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");
//end of template



N =toInt(inputs[0]);

function defalult_insert(key,value) {
    d[key].push(value);
}
function insert_route(ab) {
    var a=ab[0]-1,b=ab[1]-1;

    defalult_insert(a,b);
    defalult_insert(b,a);
}

var get_distance = function (_from) {
    var visited = new std.set();
    visited.insert(_from);

    var distance = [];
    var to_visit = new std.queue();
    to_visit.push([0,_from]);
    while(!to_visit.empty()){
        var dist_now = to_visit.front();
        to_visit.pop();
        var dist = dist_now[0];
        var now = dist_now[1];
        //print(dist_now);

        visited.insert(now);
        distance[now] = dist;
        for(var i=0;i<d[now].length;i++){
            //if(visited.indexOf(d[now][i])<0){
            if(visited.find(d[now][i])==visited.end()){
                to_visit.push([dist+1,d[now][i]])
            }
        }
    };
    return distance
};




var d= [];//new std.HashMap();
for(var i=0;i<N;i++){
    d[i]=[];
}

for(var i=0;i<N-1;i++){
    var ab = toIntArr(inputs[i+1]);
    insert_route(ab);
}

a= (get_distance(0));
b=(get_distance(N-1));

a_count=0;
b_count=0;
for(var i=0;i<N;i++){
    if(a[i]<=b[i]){
        a_count++;
    }
    else {
        b_count++;
    }
}
print(a_count>b_count?"Fennec":"Snuke")