module.exports=function(t){var r={};function i(n){if(r[n])return r[n].exports;var e=r[n]={i:n,l:!1,exports:{}};return t[n].call(e.exports,e,e.exports,i),e.l=!0,e.exports}return i.m=t,i.c=r,i.d=function(t,r,n){i.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,r){if(1&r&&(t=i(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var e in t)i.d(n,e,function(r){return t[r]}.bind(null,e));return n},i.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(r,"a",r),r},i.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},i.p="",i(i.s=0)}([function(t,r,i){"use strict";var n=i(1);i(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,r){t.exports=require("fs")},function(t,r,i){"use strict";var n=i(3),e=i(5);t.exports=function(t){var r=new n(t);e(r)}},function(t,r,i){"use strict";var n=i(4);t.exports=class{constructor(t){var r=t.trim().split(/\s+/g);this.inp=new n(r)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,r,i){"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,r,i){"use strict";var n=i(6);t.exports=function(t){for(var r=t.in(),i=t.in(),e=new n(r),s=0;s<i;s++){var o=t.in(),u=t.in();e.unite(o-1,u-1)}for(var a=t.in(),c=0;c<a;c++){var f=t.in(),h=t.in();e.isSameGroup(f-1,h-1)?console.log("yes"):console.log("no")}}},function(t,r,i){"use strict";t.exports=class{constructor(t){this.N=t,this.par=new Array(this.N),this.rank=new Array(this.N);for(var r=0;r<this.N;r++)this.par[r]=r,this.rank[r]=0}find(t){return this.par[t]==t?t:this.par[t]=this.find(this.par[t])}unite(t,r){var i=this.find(t),n=this.find(r);i!=n&&(this.rank[i]<this.rank[n]?this.par[i]=n:(this.par[n]=i,this.rank[i]==this.rank[n]&&this.rank[i]++))}isSameGroup(t,r){return this.find(t)==this.find(r)}}}]);
