module.exports=function(t){var i={};function e(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}return e.m=t,e.c=i,e.d=function(t,i,r){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var n in t)e.d(r,n,function(i){return t[i]}.bind(null,n));return r},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=0)}([function(t,i,e){"use strict";var r=e(1);e(2)(r.readFileSync("/dev/stdin","utf8"))},function(t,i){t.exports=require("fs")},function(t,i,e){"use strict";var r=e(3),n=e(5);t.exports=function(t){var i=new r(t);n(i)}},function(t,i,e){"use strict";var r=e(4);t.exports=class{constructor(t){var i=t.trim().split(/\s+/g);this.inp=new r(i)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,i,e){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,i,e){"use strict";t.exports=function(t){for(var i=t.in(),e=t.in()-1,r=t.in()-1,n=new Array(i),s=new Array(i),o=0;o<i;o++)n[o]=[],s[o]={visT:0,visA:0,disT:-1,disA:-1};for(var u=0;u<i-1;u++){var d=t.in()-1,a=t.in()-1;n[d].push(a),n[a].push(d)}s[r].visA=1,s[r].disA=0;for(var c=[{v:r,dis:0}];c.length>0;)for(var f=c.pop(),v=n[f.v],l=0;l<v.length;l++){var p=v[l];1!=s[p].visA&&(s[p].visA=1,s[p].disA=f.dis+1,c.push({v:p,dis:f.dis+1}))}s[e].visT=1,s[e].disT=0;for(var h=[{v:e,dis:0}];h.length>0;)for(var y=h.pop(),g=n[y.v],b=0;b<g.length;b++){var m=g[b];1!=s[m].visT&&(s[m].visT=1,s[m].disT=y.dis+1,s[m].disT-s[m].disA>0?s[m].disT=-1:s[m].disT-s[m].disA!=0&&h.push({v:m,dis:y.dis+1}))}for(var T=0,x=0;x<i;x++)T=Math.max(T,s[x].disT);console.log(T)}}]);
