module.exports=function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t,i){"use strict";var r=i(1);i(2)(r.readFileSync("/dev/stdin","utf8"))},function(e,t){e.exports=require("fs")},function(e,t,i){"use strict";var r=i(3),n=i(5);e.exports=function(e){var t=new r(e);n(t)}},function(e,t,i){"use strict";var r=i(4);e.exports=class{constructor(e){var t=e.trim().split(/\s+/g);this.inp=new r(t)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(e,t,i){"use strict";e.exports=class{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=e.length,this.items=e,this.ind=0}enq(e){this.size+=1,this.items.push(e)}deq(){var e=this.items[this.ind];return this.size-=1,this.ind+=1,e}clear(){this.items=[],this.size=0,this.ind=0}}},function(e,t,i){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=[],r=!0,n=!1,s=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(i.push(a.value),!t||i.length!==t);r=!0);}catch(e){n=!0,s=e}finally{try{r||null==u.return||u.return()}finally{if(n)throw s}}return i}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var n=i(6);e.exports=function(e){for(var t=e.in(),i=e.in(),s=e.in(),a=new Array(t),u=0;u<t;u++)a[u]=[];for(var h=0;h<i;h++){var o=e.in(),l=e.in(),p=e.in();a[o].push({v:l,c:p})}for(var v=r(n(a,s,9999999999),2),f=v[0],c=(v[1],0);c<t;c++)f[c]<9999999999?console.log(f[c]):console.log("INF")}},function(e,t,i){"use strict";class r{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:a;this.cf=t?n:s,this.kgf=r,this.table=new Map;var u=e.length;this.heap=new Array(u);for(var h=0;h<u;h++){var o={value:e[h],index:h};this.heap[h]=o;var l=this.kgf(e[h]);this.table[l]=o}i&&(this.cf=i),this.size=this.heap.length,this.heapify()}findItem(e){var t=this.kgf(e);return this.table[t]}heapify(){for(var e=0,t=this.size;2*e+1<=t;)e=2*e+1;for(var i=e-1;i>=0;)2*i+1>t-1?i--:(this.downHeap(i),i--)}downHeap(e){for(var t=this.size,i=e;2*i+1<=t-1;){var r=this.heap[2*i+1],n=2*i+2<=t-1?this.heap[2*i+2]:r,s=this.cf(n.value,r.value)?r:n,a=this.cf(n.value,r.value)?2*i+1:2*i+2;if(this.cf(s.value,this.heap[i].value))break;var u=s;this.heap[a]=this.heap[i],this.heap[i]=u,this.heap[a].index=a,this.heap[i].index=i,i=a}}upHeap(e){for(var t=e;0!=t;){var i=Math.floor((t-1)/2);if(this.cf(this.heap[t].value,this.heap[i].value))break;var r=this.heap[i];this.heap[i]=this.heap[t],this.heap[t]=r,this.heap[t].index=t,this.heap[i].index=i,t=i}}pushItem(e){this.size+=1;var t=this.heap.length,i={value:e,index:t};this.heap.push(i);var r=this.kgf(e);this.table[r]=i,this.upHeap(t)}getTop(){return this.heap[0].value}removeTop(){if(0==this.size)return!1;if(1==this.size){this.size=0;var e=this.heap[0],t=this.kgf(e.value);return this.table[t]=void 0,this.heap=[],!0}this.size-=1;var i=this.heap[0],r=this.kgf(i.value);return this.table[r]=void 0,this.heap[0]=this.heap.pop(),this.heap[0].index=0,this.downHeap(0),!0}getValuesList(){for(var e=this.heap.length,t=[],i=0;i<e;i++)t.push(this.heap[i].value);return t}}function n(e,t){return e<=t}function s(e,t){return e>=t}function a(e){return e.toString()}class u{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.queue=new r(e,!1,h,o)}enq(e,t){var i={value:e,priority:t};this.queue.pushItem(i)}deq(){var e=this.queue.getTop();return this.queue.removeTop(),e.value}isEmpty(){return 0==this.queue.size}update(e,t){var i=this.queue.findItem({value:e});if(i){var r=i.value,n=i.index,s=r.priority;s!=t&&(r.priority=t,t<s?this.queue.upHeap(n):this.queue.downHeap(n))}}}function h(e,t){return e.priority>=t.priority}function o(e){return`${e.value}`}e.exports=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:9999999999,r=e.length,n=new Array(r).fill(i);n[t]=0;for(var s=new Array(r).fill(-1),a=new u,h=0;h<r;h++)a.enq(h,n[h]);for(;!a.isEmpty();){var o=a.deq(),l=!0,p=!1,v=void 0;try{for(var f,c=e[o][Symbol.iterator]();!(l=(f=c.next()).done);l=!0){var d=f.value,y=n[o]+d.c;n[d.v]>y&&(n[d.v]=y,s[d.v]=o,a.update(d.v,y))}}catch(e){p=!0,v=e}finally{try{l||null==c.return||c.return()}finally{if(p)throw v}}}return[n,s]}}]);


Measured memory_bytes: 209304