!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){"use strict";var r=this&&this.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0;var i=o(n(1));e.readInput=function(){return new Promise(function(t,e){i.default.readFile("/dev/stdin","utf8",function(n,r){n?e(n):t(r)})})},e.getFoolIterator=function(t){var e,n;return r(this,function(r){switch(r.label){case 0:e=t.split(/\s+/).filter(function(t){return t.length>0}),n=0,r.label=1;case 1:return n<e.length?[4,e[n]]:[3,4];case 2:r.sent(),r.label=3;case 3:return n++,[3,1];case 4:return[2]}})}},function(t,e){t.exports=require("fs")},,function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{l(r.next(t))}catch(t){i(t)}}function a(t){try{l(r.throw(t))}catch(t){i(t)}}function l(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,a)}l((r=r.apply(t,e||[])).next())})},o=this&&this.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this;e.__esModule=!0;var u=n(4),a=n(0);r(i,void 0,void 0,function(){var t,e,n,r,i,l,s,c,f,h,p,b,d,v,y,w;return o(this,function(o){switch(o.label){case 0:return[4,a.readInput()];case 1:for(t=o.sent(),e=a.getFoolIterator(t),r=(n=function(){return parseInt(e.next().value)})(),i=n(),l=new Array(i),s=new u.UnionFind(r),c=new Array(i),h=0;h<i;h++)b=n()-1,d=n()-1,c[h]={a:b,b:d};for(f=r*(r-1),h=i-1;h>=0;h--)l[h]=Math.floor(f/2),p=c[h],b=p.a,d=p.b,s.find(b,d)||(v=s.size(b),y=s.size(d),f=f-(v*(r-v)+y*(r-y))+(w=v+y)*(r-w),s.union(b,d));return l.forEach(function(t){return console.log(t)}),[2]}})})},function(t,e,n){"use strict";e.__esModule=!0;var r=function(){function t(t){this.v=new Array(t),this.v.fill(-1)}return t.prototype.union=function(t,e){if(!this.find(t,e)){var n=this.root(t),r=this.root(e);this.size(n)>this.size(r)?(this.v[n]+=this.v[r],this.v[r]=n):(this.v[r]+=this.v[n],this.v[n]=r)}},t.prototype.find=function(t,e){return this.root(t)===this.root(e)},t.prototype.root=function(t){return this.v[t]<0?t:(this.v[t]=this.root(this.v[t]),this.v[t])},t.prototype.size=function(t){return-this.v[this.root(t)]},t}();e.UnionFind=r}]);

Measured memory_bytes: 81208