Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@哔嘀影视@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoi5ZOU5ZiA5b2x6KeGIiwiYXV0aG9yIjoiIiwidXJsIjoiaGlrZXI6Ly9lbXB0eSMjZnlwYWdlIiwidmVyc2lvbiI6NSwiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOlxudmFyIGQgPSBbXVxudmFyIHBhZ2UgPSBNWV9QQUdFXG4vL3ZhciBodG1sID0gZmV0Y2goY29uZmlnLmluZGV4ICsgYHMvYWxsLyR7cGFnZX1gKVxuXG5NWV9VUkwgPSBjb25maWcuaW5kZXggKyBgcy9hbGwvJHtwYWdlfWBcblxuLy9jbGVhclZhcihNWV9SVUxFLnRpdGxlICsgJ3VybCcpXG5cbnZhciBnZXRSYW5nZUNvbG9ycyA9IGZ1bmN0aW9uKCkge8KgwqDCoMKgwqDCoMKgXG4gICAgcmV0dXJuICcjJyArICgnMDAwMDAnICsgKE1hdGgucmFuZG9tKCkgKiAweDEwMDAwMDAgPDwgMCkudG9TdHJpbmcoMTYpKS5zdWJzdHIoLTYpO8KgwqDCoMKgwqBcbn1cblxuY29uc3Qg5YiG57G76aKc6ImyID0gZ2V0UmFuZ2VDb2xvcnMoKVxuY29uc3Qg5aSn57G75a6a5L2NID0gJ2JvZHkmJmRpdi5uYXZiYXItZXhwYW5kLW1kJiYubmF2YmFyLW5hdidcbmNvbnN0IOaLvOaOpeWIhuexuyA9IFwiYm9keSYmZGxcIlxuY29uc3Qg5bCP57G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AnXFxcIj4nICsgdGl0bGUgKyAnPC9zcGFuPjwvYj4nIDogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6ICQocGQoaXRlbSwg5YiG57G76ZO+5o6lKSArICcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgbmV3X2NhdGUgPSBbXVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXAuZm9yRWFjaCgoY2F0ZSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3X2NhdGUucHVzaChpbmRleCA9PT0gMCA/IHBhcmFtcy5rZXkudG9TdHJpbmcoKSA6IFxcXCIwXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dFZhcihNWV9SVUxFLnRpdGxlLCBKU09OLnN0cmluZ2lmeShuZXdfY2F0ZSkpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0VmFyKE1ZX1JVTEUudGl0bGUrJ3VybCcsIGlucHV0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKHRydWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGtleToga2V5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2U6IHBhZ2UsXFxuICAgICAgICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIlxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIGlmIChmb2xkID09PSAnMScpIHtcXG4gICAgICAgICAgICBzdWJfY2F0ZWdvcmllcy5mb3JFYWNoKChpdGVtLCBrZXkpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gcGRmaChpdGVtLCDliIbnsbvmoIfpopgpXFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZToga2V5LnRvU3RyaW5nKCkgPT09IGNhdGVfdGVtcFtpbmRleF0gPyAn4oCc4oCc4oCd4oCdPGI+PHNwYW4gc3R5bGU9XFxcImNvbG9yOiAnICsg5YiG57G76aKc6ImyICsgJ1xcXCI+JyArIHRpdGxlICsgJzwvc3Bhbj48L2I+JyA6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKHBkKGl0ZW0sIOWIhuexu+mTvuaOpSkgKyAnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmNhdGVfdGVtcFtwYXJhbXMuaW5kZXhdID0gcGFyYW1zLmtleS50b1N0cmluZygpXFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0VmFyKE1ZX1JVTEUudGl0bGUsIEpTT04uc3RyaW5naWZ5KHBhcmFtcy5jYXRlX3RlbXApKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dFZhcihNWV9SVUxFLnRpdGxlKyd1cmwnLCBpbnB1dClcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSh0cnVlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbmRleDogaW5kZXgsXFxuICAgICAgICAgICAgICAgICAgICAgICAga2V5OiBrZXksXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXG4gICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYmxhbmtfYmxvY2tcXFwiXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgIH0pXFxufVxcblwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi5pCc57SiXCIsXCJwYXRoXCI6XCJzZWFyY2hcIixcInJ1bGVcIjpcImpzOlwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi6K+m5oOFXCIsXCJwYXRoXCI6XCJkZXRhaWxzXCIsXCJydWxlXCI6XCJqczpcXG5yZXF1aXJlKGNvbmZpZy51aSlcXG52YXIgcmVzID0ge307XFxudmFyIGQgPSBbXTtcXG52YXIgbGlzdHM9W107XFxudmFyIHRhYnNzPVtdO1xcbnZhciBodG1sID0gZ2V0UmVzQ29kZSgpO1xcbnZhciB0YWJzID0gcGRmYShodG1sLCAnYm9keSYmaDQnKTtcXG52YXIgY29udHMgPSBwZGZhKGh0bWwsICdib2R5JiYubXQtMzpoYXMoOm1hdGNoZXMo5pKt5pS+5YiX6KGofOS4i+i9veWcsOWdgHznp43lrZDkuIvovb0pKScpO1xcblxcbi8vc2V0RXJyb3IoY29udHMubGVuZ3RoKTtcXG5cXG5mdW5jdGlvbiBjdXRzdHIo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ciBkcyA9IHN0b3JhZ2UwLmdldEl0ZW0oJ2RzaG93JywgJ+aUtui1tycpO1xcbiAgICAgICAgdmFyIHRpdGxlID0gZmluZEl0ZW0oJ2RzaG93JykudGl0bGU7XFxuXFxuICAgICAgICBpZiAoZHMgPT0gJ+aUtui1tycpIHtcXG4gICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKCdkc2hvdycsICflsZXlvIAnKVxcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oJ2Rjb250ZW50Jywge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogZGMsXFxuICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgdXBkYXRlSXRlbSgnZHNob3cnLCB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZS5yZXBsYWNlKCfmlLbotbcnLCAn5bGV5byAJylcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICB1cGRhdGVJdGVtXFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0oJ2RzaG93JywgJ+aUtui1tycpXFxuICAgICAgICAgICAgdXBkYXRlSXRlbSgnZGNvbnRlbnQnLCB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBzZGMsXFxuICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgdXBkYXRlSXRlbSgnZHNob3cnLCB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZS5yZXBsYWNlKCflsZXlvIAnLCAn5pS26LW3JylcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgfSwgZGVzYywgc2Rlc2MpLFxcbiAgICBleHRyYToge1xcbiAgICAgICAgaWQ6ICdkc2hvdycsXFxuICAgIH1cXG59KVxcblxcblxcbmQucHVzaCh7XFxuICAgIHRpdGxlOiBzdG9yYWdlMC5nZXRJdGVtKCdkc2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gnJykubGF6eVJ1bGUoKCkgPT4ge1xcbiAgICB2YXIgdXJsPWlucHV0O1xcbiAgICB2YXIgaG9tZSA9ICdiZHlzJztcXG4gICAgdmFyIGh0bWwgPSBmZXRjaCh1cmwsIHtcXG4gICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAnY29va2llJzogZ2V0SXRlbShob21lICsgJ0Nvb2tpZScsICcnKSxcXG4gICAgICAgIH1cXG4gICAgfSlcXG4gICAgaWYgKGh0bWwuaW5jbHVkZXMoJ1BsZWFzZSBjb21wbGV0ZSB0aGUgY2FwdGNoYScpKSB7XFxuICAgICAgICBjbGVhclZhcihob21lICsgJ0Nvb2tpZScpO1xcbiAgICAgICAgY2xlYXJJdGVtKGhvbWUgKyAnQ29va2llJyk7ICAgICAgICBcXG4gICAgICAgIHJldHVybiAkKCdoaWtlcjovL2VtcHR5JykucnVsZSgoaG9tZSwgdXJsKSA9PiB7XFxuICAgICAgICAgICAgdmFyIGQgPSBbXTtcXG4gICAgICAgICAgICB2YXIgY29va2llID0gZ2V0VmFyKGhvbWUgKyAnQ29va2llJywgJycpO1xcbiAgICAgICAgICAgIC8vbG9nKGNvb2tpZSlcXG4gICAgICAgICAgICBpZiAoY29va2llICE9ICcnKSB7XFxuICAgICAgICAgICAgICAgIHNldEl0ZW0oaG9tZSArICdDb29raWUnLCBjb29raWUpO1xcbiAgICAgICAgICAgICAgICBiYWNrKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgdG9hc3QoJ+mqjOivgeWujOaIkCcpXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hYNVdlYlZpZXcoJ2hpa2VyOi8vZW1wdHknKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ4NV93ZWJ2aWV3X3NpbmdsZVxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBcXFwiZmxvYXQmJjEwMCVcXFwiLFxcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaG9tZSwgdXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZWxlbWVudElkID0gXFxcIm1ldGFbcHJvcGVydHk9J29nOnR5cGUnXVxcXCI7IC8vIOW+heajgOafpeeahOWFg+e0oCBJRCBcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBpbnRlcnZhbFRpbWUgPSAxMDAwOyAvLyDmr4/pmpQgMSDnp5Lpkp/mo4Dmn6XkuIDmrKEgXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdGltZXIgPSBzZXRJbnRlcnZhbCgoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVsZW1lbnQgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKGVsZW1lbnRJZCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbGVtZW50KSB7IC8vIOWtmOWcqOivpeWFg+e0oO+8jOWPr+S7peaJp+ihjOafkOS6m+aTjeS9nCBcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vZmJhLmxvZygn5a2Y5ZyoJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZiYS5yZWZyZXNoWDVEZXNjKCdmbG9hdCYmMCcpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zdHlsZS5jb2xvciA9ICdyZWQnO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmJhLnB1dFZhcihob21lICsgJ0Nvb2tpZScsIGZiYS5nZXRDb29raWUodXJsKSk7ICAgICAgICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnlfYnJpZGdlX2FwcC5yZWZyZXNoUGFnZSh0cnVlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwodGltZXIpOyAvLyDmuIXpmaTlrprml7blmaggXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9mYmEubG9nKCfkuI3lrZjlnKgnKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpbnRlcnZhbFRpbWUpO1xcbiAgICAgICAgICAgICAgICAgICAgfSwgaG9tZSwgdXJsKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgc2V0SG9tZVJlc3VsdChkKVxcbiAgICAgICAgfSwgaG9tZSwgdXJsKVxcbiAgICB9XFxuICAgIGV2YWwoSlNPTi5wYXJzZShmZXRjaCgnaGlrZXI6Ly9wYWdlL3BhcnNlJywge30pKS5ydWxlKTtcXG4gICAgcmV0dXJuIHVybDtcXG59KTtcIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIumqjOivgeeggVwiLFwicGF0aFwiOlwieXptXCIsXCJydWxlXCI6XCJpZiAoaHRtbC5pbmRleE9mKCfovpPlhaXpqozor4HnoIEnKSA+IC0xKSB7XFxuXFxuICAgIGxldCBoZWFkZXJzID0ge1xcbiAgICAgICAgXFxcIlVzZXItQWdlbnRcXFwiOiBNT0JJTEVfVUEsXFxuICAgICAgICBcXFwiUmVmZXJlclxcXCI6IE1ZX1VSTFxcbiAgICB9O1xcbiAgICBldmFsKEpTT04ucGFyc2UocmVxdWVzdCgnaGlrZXI6Ly9wYWdlL2p4aHM/cnVsZT3mqKHmnb/Ct1EnKSkucnVsZSk7XFxuICAgIGV2YWxQcml2YXRlSlMoc3N5eik7XFxuXFxuXFxuICAgIHZhciBjb2RldXJsID0gY29uZmlnLmluZGV4ICsgcGRmaChodG1sLCAnI3ZlcmlmeUNvZGUmJnNyYycpLnNsaWNlKDEpXFxuXFxuXFxuICAgIC8vbG9nKGNvZGV1cmwpXFxuXFxuICAgIGxldCB2Y29kZSA9IGdldFZDb2RlMihjb2RldXJsLCBKU09OLnN0cmluZ2lmeShoZWFkZXJzKSwgJ3N0cmluZycpO1xcblxcbiAgICB2YXIgc3RyID0gSlNPTi5wYXJzZSh2Y29kZSkudGV4dC5yZXBsYWNlKCc9JywgJycpLnJlcGxhY2UoLyh4fMOXKS8sICcqJykucmVwbGFjZSgnw7cnLCAnLycpXFxuXFxuICAgIHZhciBudW0gPSAwO1xcbiAgICBudW0gPSBldmFsKHN0cilcXG4gICAgbG9nKG51bSlcXG5cXG4gICAgdmFyIGN1cmwgPSBNWV9VUkwgKyAnP2NvZGU9JyArIG51bTtcXG5cXG4gICAgLy9sb2coY3VybClcXG5cXG4gICAgaHRtbCA9IGZldGNoKGN1cmwsIHtcXG4gICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxuICAgIH0pXFxuICAgIGlmIChodG1sLmluZGV4T2YoJ+i+k+WFpemqjOivgeeggScpID09IC0xKSB7XFxuICAgICAgICB2YXIgY29va2llID0gZ2V0Q29va2llKGN1cmwpXFxuICAgICAgICBwdXRNeVZhcignY29va2llJywgY29va2llKVxcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+iHquWKqOivhuWIq+Wksei0pe+8jOivt+WIt+aWsOmHjeivleaIluiAheaJi+WKqOmqjOivgSdcXG4gICAgICAgIH0pXFxuICAgICAgICBcXG4gICAgICAgIHZhciBkaWN0ID0ge1xcbiAgICAgICAgICAgIG15dXJsOiBNWV9VUkwsXFxuICAgICAgICAgICAgdmNvZGU6IGNvZGV1cmxcXG4gICAgICAgIH1cXG5cXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfngrnmiJHmiYvliqjpqozor4EnLFxcbiAgICAgICAgICAgIHVybDogJCgnaGlrZXI6Ly9lbXB0eSMjJykucnVsZSgoZGljdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoJ+ivt+i+k+WFpeiuoeeul+e7k+aenCcpO1xcbiAgICAgICAgICAgICAgICB2YXIgZCA9IFtdO1xcbiAgICAgICAgICAgICAgICB2YXIgbXl1cmwgPSBkaWN0Lm15dXJsO1xcbiAgICAgICAgICAgICAgICB2YXIgaHRtbCA9IGZldGNoKG15dXJsKTtcXG4gICAgICAgICAgICAgICAgdmFyIGNvZGV1cmwgPSBjb25maWcuaW5kZXggKyBwZGZoKGh0bWwsICcjdmVyaWZ5Q29kZSYmc3JjJykuc2xpY2UoMSk7XFxuICAgICAgICAgICAgICAgIHZhciBiNjQgPSBjb252ZXJ0QmFzZTY0SW1hZ2UoY29kZXVybClcXG5cXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIGltZzogYjY0LFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdwaWNfMV9mdWxsJyxcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn56Gu6K6kJyxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnaW5wdXQnLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkLnRvU3RyaW5nKChteXVybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjdXJsID0gbXl1cmwgKyAnP2NvZGU9JyArIGlucHV0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKGN1cmwpXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGhlYWRlcnMgPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJVc2VyLUFnZW50XFxcIjogTU9CSUxFX1VBLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwiUmVmZXJlclxcXCI6IG15dXJsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgaHRtbCA9IGZldGNoKGN1cmwsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaHRtbC5pbmRleE9mKCfovpPlhaXpqozor4HnoIEnKSA9PSAtMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgY29va2llID0gZ2V0Q29va2llKGN1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignY29va2llJywgY29va2llKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFjaygpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn5oiQ5Yqf77yM6K+35Yiw5pCc57Si6aG15Yi35pawJylcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn6ZSZ6K+v6K+36YeN6K+VJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICAgICAgICAgICAgICAgICAgfSwgbXl1cmwpLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbnVtYmVyJ1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBzZXRSZXN1bHQoZCk7XFxuICAgICAgICAgICAgfSwgZGljdClcXG4gICA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IgaSA9IG5ldyBFcnJvcihcXFwiQ2Fubm90IGZpbmQgbW9kdWxlICdcXFwiICsgZSArIFxcXCInXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBpLmNvZGUgPSBcXFwiTU9EVUxFX05PVF9GT1VORFxcXCIsIGlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB2YXIgbiA9IG9bZV0gPSB7XFxuICAgICAgICAgICAgICAgICAgICBleHBvcnRzOiB7fVxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICBzW2VdWzBdLmNhbGwobi5leHBvcnRzLCBmdW5jdGlvbih0KSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaChzW2VdWzFdW3RdIHx8IHQpXFxuICAgICAgICAgICAgICAgIH0sIG4sIG4uZXhwb3J0cywgciwgcywgbywgbClcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIG9bZV0uZXhwb3J0c1xcbiAgICAgICAgfVxcbiAgICAgICAgZm9yICh2YXIgZCA9IFxcXCJmdW5jdGlvblxcXCIgPT0gdHlwZW9mIHJlcXVpcmUgJiYgcmVxdWlyZSwgdCA9IDA7IHQgPCBsLmxlbmd0aDsgdCsrKSBoKGxbdF0pO1xcbiAgICAgICAgcmV0dXJuIGhcXG4gICAgfSh7XFxuICAgICAgICAxOiBbZnVuY3Rpb24odCwgZSwgYSkge1xcbiAgICAgICAgICAgIFxcXCJ1c2Ugc3RyaWN0XFxcIjtcXG4gICAgICAgICAgICB2YXIgcyA9IHQoXFxcIi4vemxpYi9kZWZsYXRlXFxcIiksXFxuICAgICAgICAgICAgICAgIG8gPSB0KFxcXCIuL3V0aWxzL2NvbW1vblxcXCIpLFxcbiAgICAgICAgICAgICAgICBsID0gdChcXFwiLi91dGlscy9zdHJpbmdzXFxcIiksXFxuICAgICAgICAgICAgICAgIG4gPSB0KFxcXCIuL3psaWIvbWVzc2FnZXNcXFwiKSxcXG4gICAgICAgICAgICAgICAgciA9IHQoXFxcIi4vemxpYi96c3RyZWFtXFxcIiksXFxuICAgICAgICAgICAgICAgIGggPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLFxcbiAgICAgICAgICAgICAgICBkID0gMCxcXG4gICAgICAgICAgICAgICAgZiA9IC0xLFxcbiAgICAgICAgICAgICAgICBfID0gMCxcXG4gICAgICAgICAgICAgICAgdSA9IDg7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gYyh0KSB7XFxuICAgICAgICAgICAgICAgIGlmICghKHRoaXMgaW5zdGFuY2VvZiBjKSkgcmV0dXJuIG5ldyBjKHQpO1xcbiAgICAgICAgICAgICAgICB0aGlzLm9wdGlvbnMgPSBvLmFzc2lnbih7XFxuICAgICAgICAgICAgICAgICAgICBsZXZlbDogZixcXG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogdSxcXG4gICAgICAgICAgICAgICAgICAgIGNodW5rU2l6ZTogMTYzODQsXFxuICAgICAgICAgICAgICAgICAgICB3aW5kb3dCaXRzOiAxNSxcXG4gICAgICAgICAgICAgICAgICAgIG1lbUxldmVsOiA4LFxcbiAgICAgICAgICAgICAgICAgICAgc3RyYXRlZ3k6IF8sXFxuICAgICAgICAgICAgICAgICAgICB0bzogXFxcIlxcXCJcXG4gICAgICAgICAgICAgICAgfSwgdCB8fCB7fSk7XFxuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5vcHRpb25zO1xcbiAgICAgICAgICAgICAgICBlLnJhdyAmJiAwIDwgZS53aW5kb3dCaXRzID8gZS53aW5kb3dCaXRzID0gLWUud2luZG93Qml0cyA6IGUuZ3ppcCAmJiAwIDwgZS53aW5kb3dCaXRzICYmIGUud2luZG93Qml0cyA8IDE2ICYmIChlLndpbmRvd0JpdHMgKz0gMTYpLCB0aGlzLmVyciA9IDAsIHRoaXMubXNnID0gXFxcIlxcXCIsIHRoaXMuZW5kZWQgPSAhMSwgdGhpcy5jaHVua3MgPSBbXSwgdGhpcy5zdHJtID0gbmV3IHIsIHRoaXMuc3RybS5hdmFpbF9vdXQgPSAwO1xcbiAgICAgICAgICAgICAgICB2YXIgYSA9IHMuZGVmbGF0ZUluaXQyKHRoaXMuc3RybSwgZS5sZXZlbCwgZS5tZXRob2QsIGUud2luZG93Qml0cywgZS5tZW1MZXZlbCwgZS5zdHJhdGVneSk7XFxuICAgICAgICAgICAgICAgIGlmIChhICE9PSBkKSB0aHJvdyBuZXcgRXJyb3IoblthXSk7XFxuICAgICAgICAgICAgICAgIGlmIChlLmhlYWRlciAmJiBzLmRlZmxhdGVTZXRIZWFkZXIodGhpcy5zdHJtLCBlLmhlYWRlciksIGUuZGljdGlvbmFyeSkge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoaSA9IFxcXCJzdHJpbmdcXFwiID09IHR5cGVvZiBlLmRpY3Rpb25hcnkgPyBsLnN0cmluZzJidWYoZS5kaWN0aW9uYXJ5KSA6IFxcXCJbb2JqZWN0IEFycmF5QnVmZmVyXVxcXCIgPT09IGguY2FsbChlLmRpY3Rpb25hcnkpID8gbmV3IFVpbnQ4QXJyYXkoZS5kaWN0aW9uYXJ5KSA6IGUuZGljdGlvbmFyeSwgKGEgPSBzLmRlZmxhdGVTZXREaWN0aW9uYXJ5KHRoaXMuc3RybSwgaSkpICE9PSBkKSB0aHJvdyBuZXcgRXJyb3IoblthXSk7XFxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9kaWN0X3NldCA9ICEwXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gaSh0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IGMoZSk7XFxuICAgICAgICAgICAgICAgIGlmIChhLnB1c2godCwgITApLCBhLmVycikgdGhyb3cgYS5tc2cgfHwgblthLmVycl07XFxuICAgICAgICAgICAgICAgIHJldHVybiBhLnJlc3VsdFx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gICAgICAgICAgICAgICAgcmV0dXJuIChlID0gZSB8fCB7fSkuZ3ppcCA9ICEwLCBpKHQsIGUpXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgIFxcXCIuL3V0aWxzL2NvbW1vblxcXCI6IDMsXFxuICAgICAgICAgICAgXFxcIi4vdXRpbHMvc3RyaW5nc1xcXCI6IDQsXFxuICAgICAgICAgICAgXFxcIi4vemxpYi9kZWZsYXRlXFxcIjogOCxcXG4gICAgICAgICAgICBcXFwiLi96bGliL21lc3NhZ2VzXFxcIjogMTMsXFxuICAgICAgICAgICAgXFxcIi4vemxpYi96c3RyZWFtXFxcIjogMTVcXG4gICAgICAgIH1dLFxcbiAgICAgICAgMjogW2Z1bmN0aW9uKHQsIGUsIGEpIHtcXG4gICAgICAgICAgICBcXFwidXNlIHN0cmljdFxcXCI7XFxuICAgICAgICAgICAgdmFyIGYgPSB0KFxcXCIuL3psaWIvaW5mbGF0ZVxcXCIpLFxcbiAgICAgICAgICAgICAgICBfID0gdChcXFwiLi91dGlscy9jb21tb25cXFwiKSxcXG4gICAgICAgICAgICAgICAgdSA9IHQoXFxcIi4vdXRpbHMvc3RyaW5nc1xcXCIpLFxcbiAgICAgICAgICAgICAgICBjID0gdChcXFwiLi96bGliL2NvbnN0YW50c1xcXCIpLFxcbiAgICAgICAgICAgICAgICBpID0gdChcXFwiLi96bGliL21lc3NhZ2VzXFxcIiksXFxuICAgICAgICAgICAgICAgIG4gPSB0KFxcXCIuL3psaWIvenN0cmVhbVxcXCIpLFxcbiAgICAgICAgICAgICAgICByID0gdChcXFwiLi96bGliL2d6aGVhZGVyXFxcIiksXFxuICAgICAgICAgICAgICAgIGIgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nO1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIHModCkge1xcbiAgICAgICAgICAgICAgICBpZiAoISh0aGlzIGluc3RhbmNlb2YgcykpIHJldHVybiBuZXcgcyh0KTtcXG4gICAgICAgICAgICAgICAgdGhpcy5vcHRpb25zID0gXy5hc3NpZ24oe1xcbiAgICAgICAgICAgICAgICAgICAgY2h1bmtTaXplOiAxNjM4NCxcXG4gICAgICAgICAgICAgICAgICAgIHdpbmRvd0JpdHM6IDAsXFxuICAgICAgICAgICAgICAgICAgICB0bzogXFxcIlxcXCJcXG4gICAgICAgICAgICAgICAgfSwgdCB8fCB7fSk7XFxuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5vcHRpb25zO1xcbiAgICAgICAgICAgICAgICBlLnJhdyAmJiAwIDw9IGUud2luZG93Qml0cyAmJiBlLndpbmRvd0JpdHMgPCAxNiAmJiAoZS53aW5kb3dCaXRzID0gLWUud2luZG93Qml0cywgMCA9PT0gZS53aW5kb3dCaXRzICYmIChlLndpbmRvd0JpdHMgPSAtMTUpKSwgISgwIDw9IGUud2luZG93Qml0cyAmJiBlLndpbmRvd0JpdHMgPCAxNikgfHwgdCAmJiB0LndpbmRvd0JpdHMgfHwgKGUud2luZG93Qml0cyArPSAzMiksIDE1IDwgZS53aW5kb3dCaXRzICYmIGUud2luZG93Qml0cyA8IDQ4ICYmIDAgPT0gKDE1ICYgZS53aW5kb3dCaXRzKSAmJiAoZS53aW5kb3dCaXRzIHw9IDE1KSwgdGhpcy5lcnIgPSAwLCB0aGlzLm1zZyA9IFxcXCJcXFwiLCB0aGlzLmVuZGVkID0gITEsIHRoaXMuY2h1bmtzID0gW10sIHRoaXMuc3RybSA9IG5ldyBuLCB0aGlzLnN0cm0uYXZhaWxfb3V0ID0gMDtcXG4gICAgICAgICAgICAgICAgdmFyIGEgPSBmLmluZmxhdGVJbml0Mih0aGlzLnN0cm0sIGUud2luZG93Qml0cyk7XFxuICAgICAgICAgICAgICAgIGlmIChhICE9PSBjLlpfT0spIHRocm93IG5ldyBFcnJvcihpW2FdKTtcXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuaGVhZGVyID0gbmV3IHIsIGYuaW5mbGF0ZUdldEhlYW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AgICBhLmFzc2lnbiA9IGZ1bmN0aW9uKHQpIHtcXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgZSwgYSwgaSA9IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMSk7IGkubGVuZ3RoOykge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpLnNoaWZ0KCk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAobikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChcXFwib2JqZWN0XFxcIiAhPSB0eXBlb2YgbikgdGhyb3cgbmV3IFR5cGVFcnJvcihuICsgXFxcIm11c3QgYmUgbm9uLW9iamVjdFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gbikgZSA9IG4sIGEgPSByLCBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSwgYSkgJiYgKHRbcl0gPSBuW3JdKVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiB0XFxuICAgICAgICAgICAgfSwgYS5zaHJpbmtCdWYgPSBmdW5jdGlvbih0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0Lmxlbmd0aCA9PT0gZSA/IHQgOiB0LnN1YmFycmF5ID8gdC5zdWJhcnJheSgwLCBlKSA6ICh0Lmxlbmd0aCA9IGUsIHQpXFxuICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICB2YXIgbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgIGFycmF5U2V0OiBmdW5jdGlvbih0LCBlLCBhLCBpLCBuKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuc3ViYXJyYXkgJiYgdC5zdWJhcnJheSkgdC5zZXQoZS5zdWJhcnJheShhLCBhICsgaSksIG4pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IDA7IHIgPCBpOyByKyspIHRbbiArIHJdID0gZVthICsgcl1cXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICBmbGF0dGVuQ2h1bmtzOiBmdW5jdGlvbih0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIGEsIGksIG4sIHIsIHM7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlID0gaSA9IDAsIGEgPSB0Lmxlbmd0aDsgZSA8IGE7IGUrKykgaSArPSB0W2VdLmxlbmd0aDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHMgPSBuZXcgVWludDhBcnJheShpKSwgZSA9IG4gPSAwLCBhID0gdC5sZW5ndGg7IGUgPCBhOyBlKyspIHIgPSB0W2VdLCBzLnNldChyLCBuKSwgbiArPSByLmxlbmd0aDtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICByID0ge1xcbiAgICAgICAgICAgICAgICAgICAgYXJyYXlTZXQ6IGZ1bmN0aW9uKHQsIGUsIGEsIGksIG4pIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IGk7IHIrKykgdFtuICsgcl0gPSBlW2EgKyByXVxcbiAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIGZsYXR0ZW5DaHVua3M6IGZ1bmN0aW9uKHQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW10uY29uY2F0LmFwcGx5KFtdLCB0KVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIGEuc2V0VHlwZWQgPSBmdW5jdGlvbih0KSB7XFxuICAgICAgICAgICAgICAgIHQgPyAoYS5CdWY4ID0gVWludDhBcnJheSwgYS5CdWYxNiA9IFVpbnQxNkFycmF5LCBhLkJ1ZjMyID0gSW50MzJBcnJheSwgYS5hc3NpZ24oYSwgbikpIDogKGEuQnVmOCA9IEFycmF5LCBhLkJ1ZjE2ID0gQXJyYXksIGEuQnVmMzIgPSBBcnJheSwgYS5hc3NpZ24oYSwgcikpXFxuICAgICAgICAgICAgfSwgYS5zZXRUeXBlZChpKVxcbiAgICAgICAgfSwge31dLFxcbiAgICAgICAgNDogW2Z1bmN0aW9uKHQsIGUsIGEpIHtcXG4gICAgICAgICAgICBcXFwidXNlIHN0cmljdFxcXCI7XFxuICAgICAgICAgICAgdmFyIGwgPSB0KFxcXCIuL2NvbW1vblxcXCIpLFxcbiAgICAgICAgICAgICAgICBuID0gITAsXFxuICAgICAgICAgICAgICAgIHIgPSAhMDtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KG51bGwsIFswXSlcXG4gICAgICAgICAgICB9IGNhdGNoICh0KSB7XFxuICAgICAgICAgICAgICAgIG4gPSAhMVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KG51bGwsIG5ldyBVaW50OEFycmF5KDEpKVxcbiAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHtcXG4gICAgICAgICAgICAgICAgciA9ICExXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGZvciAodmFyIGggPSBuZXcgbC5CdWY4KDI1NiksIGkgPSAwOyBpIDwgMjU2OyBpKyspIGhbaV0gPSAyNTIgPD0gaSA/IDYgOiAyNDggPD0gaSA/IDUgOiAyNDAgPD0gaSA/IDQgOiAyMjQgPD0gaSA/IDMgOiAxOTIgPD0gaSA/IDIgOiAxO1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGQodCwgZSk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AgZWxzZSBpZiAoNCA8IChyID0gaFtuXSkpIG9baSsrXSA9IDY1NTMzLCBhICs9IHIgLSAxO1xcbiAgICAgICAgICAgICAgICBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAobiAmPSAyID09PSByID8gMzEgOiAzID09PSByID8gMTUgOiA3OyAxIDwgciAmJiBhIDwgczspIG4gPSBuIDw8IDYgfCA2MyAmIHRbYSsrXSwgci0tO1xcbiAgICAgICAgICAgICAgICAgICAgMSA8IHIgPyBvW2krK10gPSA2NTUzMyA6IG4gPCA2NTUzNiA/IG9baSsrXSA9IG4gOiAobiAtPSA2NTUzNiwgb1tpKytdID0gNTUyOTYgfCBuID4+IDEwICYgMTAyMywgb1tpKytdID0gNTYzMjAgfCAxMDIzICYgbilcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXR1cm4gZChvLCBpKVxcbiAgICAgICAgICAgIH0sIGEudXRmOGJvcmRlciA9IGZ1bmN0aW9uKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGE7XFxuICAgICAgICAgICAgICAgIGZvciAoKGUgPSBlIHx8IHQubGVuZ3RoKSA+IHQubGVuZ3RoICYmIChlID0gdC5sZW5ndGgpLCBhID0gZSAtIDE7IDAgPD0gYSAmJiAxMjggPT0gKDE5MiAmIHRbYV0pOykgYS0tO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gYSA8IDAgPyBlIDogMCA9PT0gYSA/IGUgOiBhICsgaFt0W2FdXSA+IGUgPyBhIDogZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHtcXG4gICAgICAgICAgICBcXFwiLi9jb21tb25cXFwiOiAzXFxuICAgICAgICB9XSxcXG4gICAgICAgIDU6IFtmdW5jdGlvbih0LCBlLCBhKSB7XFxuICAgICAgICAgICAgXFxcInVzZSBzdHJpY3RcXFwiO1xcbiAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uKHQsIGUsIGEsIGkpIHtcXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDY1NTM1ICYgdCB8IDAsIHIgPSB0ID4+PiAxNiAmIDY1NTM1IHwgMCwgcyA9IDA7IDAgIT09IGE7KSB7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGEgLT0gcyA9IDJlMyA8IGEgPyAyZTMgOiBhOyByID0gciArIChuID0gbiArIGVbaSsrXSB8IDApIHwgMCwgLS1zOyk7XFxuICAgICAgICAgICAgICAgICAgICBuICU9IDY1NTIxLCByICU9IDY1NTIxXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIG4gfCByIDw8IDE2IHwgMFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHt9XSxcXG4gICAgICAgIDY6IFtmdW5jdGlvbih0LCBlLCBhKSB7XFxuICAgICAgICAgICAgXFxcInVzZSBzdHJpY3RcXFwiO1xcbiAgICAgICAgICAgIGUuZXhwb3J0cyA9IHtcXG4gICAgICAgICAgICAgICAgWl9OT19GTFVTSDogMCxcXG4gICAgICAgICAgICAgICAgWl9QQVJUSUFMX0ZMVVNIOiAxLFxcbiAgICAgICAgICAgICAgICBaX1NZTkNfRkxVU0g6IDIsXFxuICAgICAgICAgICAgICAgIFpfRlVMTF9GTFVTSDogMyxcXG4gICAgICAgICAgICAgICAgWl9GSU5JU0g6IDQsXFxuICAgICAgICAgICAgICAgIFpfQkxPQ0s6IDUsXFxuICAgICAgICAgICAgICAgIFpfVFJFRVM6IDYsXFxuICAgICAgICAgICAgICAgIFpfT0s6IDAsXFxuICAgICAgICAgICAgICAgIFpfU1RSRUFNX0VORDogMSxcXG4gICAgICAgICAgICAgICAgWl9ORUVEX0RJQ1Q6IDIsXFxuICAgICAgICAgICAgICAgIFpfRVJSTk86IC0xLFxcbiAgICAgICAgICAgICAgICBaX1NUUkVBTV9FUlJPUjogLTIsXFxuICAgICAgICAgICAgICAgIFpfREFUQV9FUlJPUjogLTMsXFxuICAgICAgICAgICAgICAgIFpfQlVGX0VSUk9SOiAtNSxcXG4gICAgICAgICAgICAgICAgWl9OT19DT01QUkVTU0lPTjogMCxcXG4gICAgICAgICAgICAgICAgWl9CRVNUX1NQRUVEOiAxLFxcbiAgICAgICAgICAgICAgICBaX0JFU1RfQ09NUFJFU1NJT046IDksXFxuICAgICAgICAgICAgICAgIFpfREVGQVVMVF9DT01QUkVTU0lPTjogLTEsXFxuICAgICAgICAgICAgICAgIFpfRklMVEVSRUQ6IDEsXFxuICAgICAgICAgICAgICAgIFpfSFVGRk1BTl9PTkxZOiAyLFxcbiAgICAgICAgICAgICAgICBaX1JMRTogMyxcXG4gICAgICAgICAgICAgICAgWl9GSVhFRDogNCxcXG4gICAgICAgICAgICAgICAgWl9ERUZBVUxUX1NUUkFURUdZOiAwLFxcbiAgICAgICAgICAgICAgICBaX0JJTkFSWTogMCxcXG4gICAgICAgICAgICAgICAgWl9URVhUOiAxLFxcbiAgICAgICAgICAgICAgICBaX1VOS05PV046IDIsXFxuICAgICAgICAgICAgICAgIFpfREVGTEFURUQ6IDhcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCB7fV0sXFxuICAgICAgICA3OiBbZnVuY3Rpb24odCwgZSwgYSkge1xcbiAgICAgICAgICAgIFxcXCJ1c2Ugc3RyaWN0XFxcIjtcXG4gICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uKCkge1xcbiAgICAgICAgICAgICAgICBmb3IgKHZhciB0LCBlID0gW10sIGEgPSAwOyBhIDwgMjU2OyBhKyspIHtcXG4gICAgICAgICAgICAgICAgICAgIHQgPSBhO1xcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCA4OyBpKyspIHQgPSAxICYgdCA/IDM5ODgyOTIzODQgXiB0ID4+PiAxIDogdCA+Pj4gMTtcXG4gICAgICAgICAgICAgICAgICAgIGVbYV0gPSB0XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVcXG4gICAgICAgICAgICB9KCk7XFxuICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24odCwgZSwgYSwgaSkge1xcbiAgICAgICAgICAgICAgICB2YXIgbiA9IG8sXFxuICAgICAgICAgICAgICAgICAgICByID0gaSArIGE7XFxuICAgICAgICAgICAgICAgIHQgXj0gLTE7XFxuICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSBpOyBzIDwgcjsgcysrKSB0ID0gdCA+Pj4gOCBeIG5bMjU1ICYgKHQgXiBlW3NdKV07XFxuICAgICAgICAgICAgICAgIHJldHVybiAtMSBeIHRcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCB7fV0sXFxuICAgICAgICA4OiBbZnVuY3Rpb24odCwgZSwgYSkge1xcbiAgICAgICAgICAgIFxcXCJ1c2Ugc3RyaWN0XFxcIjtcXG4gICAgICAgICAgICB2YXIgbCwgXyA9IHQoXFxcIi4uL3V0aWxzL2NvbW1vblxcXCIpLFxcbiAgICAgICAgICAgICAgICBoID0gdChcXFwiLi90cmVlc1xcXCIpLFxcbiAgICAgICAgICAgICAgICB1ID0gdChcXFwiLi9hZGxlcjMyXFxcIiksXFxuICAgICAgICAgICAgICAgIGMgPSB0KFxcXCIuL2NyYzMyXFxcIiksXFxuICAgICAgICAgICAgICAgIGkgPSB0KFxcXCIuL21lc3NhZ2VzXFxcIiksXFxuICAgICAgICAgICAgICAgIGQgPSAwLFxcbiAgICAgICAgICAgICAgICBmID0gNCxcXG4gICAgICAgICAgICAgICAgYiA9IDAsXFxuICAgICAgICAgICAgICAgIGcgPSAtMixcXG4gICAgICAgICAgICAgICAgbSA9IC0xLFxcbiAgICAgICAgICAgICAgICB3ID0gNCxcXG4gICAgICAgICAgICAgICAgbiA9IDIsXFxuICAgICAgICAgICAgICAgIHAgPSA4LFxcbiAgICAgICAgICAgICAgICB2ID0gOSxcXG4gICAgICAgICAgICAgICAgciA9IDI4NixcXG4gICAgICAgICAgICAgICAgcyA9IDMwLFxcbiAgICAgICAgICAgICAgICBvID0gMTksXFxuICAgICAgICAgICAgICAgIGsgPSAyICogciArIDEsXFxuICAgICAgICAgICAgICAgIHkgPSAxNSxcXG4gICAgICAgICAgICAgICAgeCA9IDMsXFxuICAgICAgICAgICAgICAgIHogPSAyNTgsXFxuICAgICAgICAgICAgICAgIEIgPSB6ICsgeCArIDEsXFxuICAgICAgICAgICAgICAgIFMgPSA0MixcXG4gICAgICAgICAgICAgICAgRSA9IDExMyxcXG4gICAgICAgICAgICAgICAgQSA9IDEsXFxuICAgICAgICAgICAgICAgIFogPSAyLFxcbiAgICAgICAgICAgICAgICBSID0gMyxcXG4gICAgICAgICAgICAgICAgQyA9IDQ7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gTih0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0Lm1zZyA9IGlbZV0sIGVcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gTyh0KSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAodCA8PCAxKSAtICg0IDwgdCA/IDkgOiAwKVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBEKHQpIHtcXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHQubGVuZ3RoOyAwIDw9IC0tZTspIHRbZV0gPSAwXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIEkodCkge1xcbiAgICAgICAgICAgICAgICB2YXIgZSA9IHQuc3RhdGUsXFxuICAgICAgICAgICAgICAgICAgICBhID0gZS5wZW5kaW5nO1xcbiAgICAgICAgICAgICAgICBhID4gdC5hdmFpbF9vdXQgJiYgKGEgPSB0LmF2YWlsX291dCksIDAgIT09IGEgJiYgKF8uYXJyYXlTZXQodC5vdXRwdXQsIGUucGVuZGluZ19idWYsIGUucGVuZGluZ19vdXQsIGEsIHQubmV4dF9vdXQpLCB0Lm5leHRfb3V0ICs9IGEsIGUucGVuZGluZ19vdXQgKz0gYSwgdC50b3RhbF9vdXQgKz0gYSwgdC5hdmFpbF9vdXQgLT0gYSwgZS5wZW5kaW5nIC09IGEsIDAgPT09IGUucGVuZGluZyAmJiAoZS5wZW5kaW5nX291dCA9IDApKVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBVKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgaC5fdHJfZmx1c2hfYmxvY2sodCwgMCA8PSB0LmJsb2NrX3N0YXJ0ID8gdC5ibG9ja19zdGFydCA6IC0xLCB0LnN0cnN0YXJ0IC0gdC5ibG9ja19zdGFydCwgZSksIHQuYmxvY2tfc3RhcnQgPSB0LnN0cnN0YXJ0LCBJKHQuc3RybSlcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gVCh0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHQucGVuZGluZ19idWZbdC5wZW5kaW5nKytdID0gZVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBGKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgdC5wZW5kaW5nX2J1Zlt0LnBlbmRpbmcrK10gPSBlID4+PiA4ICYgMjU1LCB0LnBlbmRpbmdfYnVmW3QucGVuZGluZysrXSA9IDI1NSAmIGVcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gTCh0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHZhciBhLCBpLCBuID0gdC5tYXhfY2hhaW5fbGVuZ3RoLFxcbiAgICAgICAgICAgICAgICAgICAgciA9IHQuc3Ryc3RhcnQsXFxuICAgICAgICAgICAgICAgICAgICBzID0gdC5wcmV2X2xlbmd0aCxcXG4gICAgICAgICAgICAgICAgICAgIG8gPSB0Lm5pY2VfbWF0Y2gsXFxuICAgICAgICAgICAgICAgICAgICBsID0gdC5zdHJzdGFydCA+IHQud19zaXplIC0gQiA/IHQuc3Ryc3RhcnQgLSAodC53X3NpemUgLSBCKSA6IDAsXFxuICAgICAgICAgICAgICAgICAgICBoID0gdC53aW5kb3csXFxuICAgICAgICAgICAgICAgICAgICBkID0gdC53X21hc2ssXFxuICAgICAgICAgICAgICAgICAgICBmID0gdC5wcmV2LFxcbiAgICAgICAgICAgICAgICAgICAgXyA9IHQuc3Ryc3RhcnQgKyB6LFxcbiAgICAgICAgICAgICAgICAgICAgdSA9IGhbciArIHMgLSAxXSxcXG4gICAgICAgICAgICAgICAgICAgIGMgPSBoW3IgKyBzXTtcXG4gICAgICAgICAgICAgICAgdC5wcmV2X2xlbmd0aCA+PSB0Lmdvb2RfbWF0Y2ggJiYgKG4gPj49IDIpLCBvID4gdC5sb29rYWhlYWQgJiYgKG8gPSB0Lmxvb2thaGVhZCk7XFxuICAgICAgICAgICAgICAgIGRvIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChoWyhhID0gZSkgKyBzXSA9PT0gYyAmJiBoW2EgKyBzIC0gMV0gPT09IHUgJiYgaFthXSA9PT0gaFtyXSAmJiBoWysrYV0gPT09IGhbciArIDFdKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgciArPSAyLCBhKys7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZG8ge30gd2hpbGUgKGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIHIgPCBfKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA9IHogLSAoXyAtIHIpLCByID0gXyAtIHosIHMgPCBpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0Lm1hdGNoX3N0YXJ0ID0gZSwgbyA8PSAocyA9IGkpKSBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdSA9IGhbciArIHMgLSAxXSwgYyA9IGhbciArIHNdXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9IHdoaWxlICgoZSA9IGZbZSAmIGRdKSA+IGwgJiYgMCAhPSAtLW4pO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gcyA8PSB0Lmxvb2thaGVhZCA/IHMgOiB0Lmxvb2thaGVhZFxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBIKHQpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGUsIGEsIGksIG4sIHIsIHMsIG8sIGwsIGgsIGQsIGYgPSB0Lndfc2l6ZTtcXG4gICAgICAgICAgICAgICAgZG8ge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSB0LndpbmRvd19zaXplIC0gdC5sb29rYWhlYWQgLSB0LnN0cnN0YXJ0LCB0LnN0cnN0YXJ0ID49IGYgKyAoZiAtIEIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChfLmFycmF5U2V0KHQud2luZG93LCB0LndpbmRvdywgZiwgZiwgMCksIHQubWF0Y2hfc3RhcnQgLT0gZiwgdC5zdHJzdGFydCAtPSBmLCB0LmJsb2NrX3N0YXJ0IC09IGYsIGUgPSBhID0gdC5oYXNoX3NpemU7IGkgPSB0LmhlYWRbLS1lXSwgdC5oZWFkW2VdID0gZiA8PSBpID8gaSAtIGYgOiAwLCAtLWE7KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSBhID0gZjsgaSA9IHQucHJldlstLWVdLCB0LnByZXZbZV0gPSBmIDw9IGkgPyBpIC0gZiA6IDAsIC0tYTspO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIG4gKz0gZlxcbiAgICAgICAgICAgICAgICAgICAgfVxc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wZW5kaW5nIC0gbiwgbikpLCBpLmd6aW5kZXggPT09IGkuZ3poZWFkLmV4dHJhLmxlbmd0aCAmJiAoaS5nemluZGV4ID0gMCwgaS5zdGF0dXMgPSA3MylcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpLnN0YXR1cyA9IDczO1xcbiAgICAgICAgICAgICAgICBpZiAoNzMgPT09IGkuc3RhdHVzKVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkuZ3poZWFkLm5hbWUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBuID0gaS5wZW5kaW5nO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkucGVuZGluZyA9PT0gaS5wZW5kaW5nX2J1Zl9zaXplICYmIChpLmd6aGVhZC5oY3JjICYmIGkucGVuZGluZyA+IG4gJiYgKHQuYWRsZXIgPSBjKHQuYWRsZXIsIGkucGVuZGluZ19idWYsIGkucGVuZGluZyAtIG4sIG4pKSwgSSh0KSwgbiA9IGkucGVuZGluZywgaS5wZW5kaW5nID09PSBpLnBlbmRpbmdfYnVmX3NpemUpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gMTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgVChpLCByID0gaS5nemluZGV4IDwgaS5nemhlYWQubmFtZS5sZW5ndGggPyAyNTUgJiBpLmd6aGVhZC5uYW1lLmNoYXJDb2RlQXQoaS5nemluZGV4KyspIDogMClcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgwICE9PSByKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpLmd6aGVhZC5oY3JjICYmIGkucGVuZGluZyA+IG4gJiYgKHQuYWRsZXIgPSBjKHQuYWRsZXIsIGkucGVuZGluZ19idWYsIGkucGVuZGluZyAtIG4sIG4pKSwgMCA9PT0gciAmJiAoaS5nemluZGV4ID0gMCwgaS5zdGF0dXMgPSA5MSlcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpLnN0YXR1cyA9IDkxO1xcbiAgICAgICAgICAgICAgICBpZiAoOTEgPT09IGkuc3RhdHVzKVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkuZ3poZWFkLmNvbW1lbnQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBuID0gaS5wZW5kaW5nO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkucGVuZGluZyA9PT0gaS5wZW5kaW5nX2J1Zl9zaXplICYmIChpLmd6aGVhZC5oY3JjICYmIGkucGVuZGluZyA+IG4gJiYgKHQuYWRsZXIgPSBjKHQuYWRsZXIsIGkucGVuZGluZ19idWYsIGkucGVuZGluZyAtIG4sIG4pKSwgSSh0KSwgbiA9IGkucGVuZGluZywgaS5wZW5kaW5nID09PSBpLnBlbmRpbmdfYnVmX3NpemUpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gMTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgVChpLCByID0gaS5nemluZGV4IDwgaS5nemhlYWQuY29tbWVudC5sZW5ndGggPyAyNTUgJiBpLmd6aGVhZC5jb21tZW50LmNoYXJDb2RlQXQoaS5nemluZGV4KyspIDogMClcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgwICE9PSByKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpLmd6aGVhZC5oY3JjICYmIGkucGVuZGluZyA+IG4gJiYgKHQuYWRsZXIgPSBjKHQuYWRsZXIsIGkucGVuZGluZ19idWYsIGkucGVuZGlu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ICYmIChIKHQpLCAwID09PSB0Lmxvb2thaGVhZCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSBkKSByZXR1cm4gQTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQubWF0Y2hfbGVuZ3RoID0gMCwgYSA9IGguX3RyX3RhbGx5KHQsIDAsIHQud2luZG93W3Quc3Ryc3RhcnRdKSwgdC5sb29rYWhlYWQtLSwgdC5zdHJzdGFydCsrLCBhICYmIChVKHQsICExKSwgMCA9PT0gdC5zdHJtLmF2YWlsX291dCkpIHJldHVybiBBXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lmluc2VydCA9IDAsIGUgPT09IGYgPyAoVSh0LCAhMCksIDAgPT09IHQuc3RybS5hdmFpbF9vdXQgPyBSIDogQykgOiB0Lmxhc3RfbGl0ICYmIChVKHQsICExKSwgMCA9PT0gdC5zdHJtLmF2YWlsX291dCkgPyBBIDogWlxcbiAgICAgICAgICAgICAgICAgICAgfShpLCBlKSA6IDMgPT09IGkuc3RyYXRlZ3kgPyBmdW5jdGlvbih0LCBlKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSwgaSwgbiwgciwgcyA9IHQud2luZG93OzspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQubG9va2FoZWFkIDw9IHopIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChIKHQpLCB0Lmxvb2thaGVhZCA8PSB6ICYmIGUgPT09IGQpIHJldHVybiBBO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IHQubG9va2FoZWFkKSBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0Lm1hdGNoX2xlbmd0aCA9IDAsIHQubG9va2FoZWFkID49IHggJiYgMCA8IHQuc3Ryc3RhcnQgJiYgKGkgPSBzW24gPSB0LnN0cnN0YXJ0IC0gMV0pID09PSBzWysrbl0gJiYgaSA9PT0gc1srK25dICYmIGkgPT09IHNbKytuXSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHQuc3Ryc3RhcnQgKyB6O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8ge30gd2hpbGUgKGkgPT09IHNbKytuXSAmJiBpID09PSBzWysrbl0gJiYgaSA9PT0gc1srK25dICYmIGkgPT09IHNbKytuXSAmJiBpID09PSBzWysrbl0gJiYgaSA9PT0gc1srK25dICYmIGkgPT09IHNbKytuXSAmJiBpID09PSBzWysrbl0gJiYgbiA8IHIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tYXRjaF9sZW5ndGggPSB6IC0gKHIgLSBuKSwgdC5tYXRjaF9sZW5ndGggPiB0Lmxvb2thaGVhZCAmJiAodC5tYXRjaF9sZW5ndGggPSB0Lmxvb2thaGVhZClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5tYXRjaF9sZW5ndGggPj0geCA/IChhID0gaC5fdHJfdGFsbHkodCwgMSwgdC5tYXRjaF9sZW5ndGggLSB4KSwgdC5sb29rYWhlYWQgLT0gdC5tYXRjaF9sZW5ndGgsIHQuc3Ryc3RhcnQgKz0gdC5tYXRjaF9sZW5ndGgsIHQubWF0Y2hfbGVuZ3RoID0gMCkgOiAoYSA9IGguX3RyX3RhbGx5KHQsIDAsIHQud2luZG93W3Quc3Ryc3RhcnRdKSwgdC5sb29rYWhlYWQtLSwgdC5zdHJzdGFydCsrKSwgYSAmJiAoVSh0LCAhMSksIDAgPT09IHQuc3R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IHUsIGMsIGIsIGcsIG0sIHcsIHAsIHYsIGssIHksIHgsIHosIEIsIFM7XFxuICAgICAgICAgICAgICAgIGEgPSB0LnN0YXRlLCBpID0gdC5uZXh0X2luLCBCID0gdC5pbnB1dCwgbiA9IGkgKyAodC5hdmFpbF9pbiAtIDUpLCByID0gdC5uZXh0X291dCwgUyA9IHQub3V0cHV0LCBzID0gciAtIChlIC0gdC5hdmFpbF9vdXQpLCBvID0gciArICh0LmF2YWlsX291dCAtIDI1NyksIGwgPSBhLmRtYXgsIGggPSBhLndzaXplLCBkID0gYS53aGF2ZSwgZiA9IGEud25leHQsIF8gPSBhLndpbmRvdywgdSA9IGEuaG9sZCwgYyA9IGEuYml0cywgYiA9IGEubGVuY29kZSwgZyA9IGEuZGlzdGNvZGUsIG0gPSAoMSA8PCBhLmxlbmJpdHMpIC0gMSwgdyA9ICgxIDw8IGEuZGlzdGJpdHMpIC0gMTtcXG4gICAgICAgICAgICAgICAgdDogZG8ge1xcbiAgICAgICAgICAgICAgICAgICAgYyA8IDE1ICYmICh1ICs9IEJbaSsrXSA8PCBjLCBjICs9IDgsIHUgKz0gQltpKytdIDw8IGMsIGMgKz0gOCksIHAgPSBiW3UgJiBtXTtcXG4gICAgICAgICAgICAgICAgICAgIGU6IGZvciAoOzspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodSA+Pj49IHYgPSBwID4+PiAyNCwgYyAtPSB2LCAwID09PSAodiA9IHAgPj4+IDE2ICYgMjU1KSkgU1tyKytdID0gNjU1MzUgJiBwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISgxNiAmIHYpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSAoNjQgJiB2KSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAgPSBiWyg2NTUzNSAmIHApICsgKHUgJiAoMSA8PCB2KSAtIDEpXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZSBlXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMzIgJiB2KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5tb2RlID0gMTI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlXFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgayA9IDY1NTM1ICYgcCwgKHYgJj0gMTUpICYmIChjIDwgdiAmJiAodSArPSBCW2krK10gPDwgYywgYyArPSA4KSwgayArPSB1ICYgKDEgPDwgdikgLSAxLCB1ID4+Pj0gdiwgYyAtPSB2KSwgYyA8IDE1ICYmICh1ICs9IEJbaSsrXSA8PCBjLCBjICs9IDgsIHUgKz0gQltpKytdIDw8IGMsIGMgKz0gOCksIHAgPSBnW3UgJiB3XTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYTogZm9yICg7Oykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUgPj4+PSB2ID0gcCA+Pj4gMjQsIGMgLT0gdiwgISgxNiAmICh2ID0gcCA+Pj4gMTYgJiAyNTUpKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09ICg2NCAmIHYpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAgPSBnWyg2NTUzNSAmIHApICsgKHUgJiAoMSA8PCB2KSAtIDEpXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWUgYVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1zZyA9IFxcXCJpbnZhbGlkIGRpc3RhbmNlIGNvZGVcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeSA9IDY1NTM1ICYgcCwgYyA8ICh2ICY9IDE1KSAmJiAodSArPSBCW2krK10gPDwgYywgKGMgKz0gOCkgPCB2ICYmICh1ICs9IEJbaSsrXSA8PCBjLCBjICs9IDgpKSwgbCA8ICh5ICs9IHUgJiAoMSA8PCB2KSAtIDEpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2tcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodSA+Pj49IHYsIGMgLT0gdiwgKHYgPSByIC0gcykgPCB5KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgPCAodiA9IHkgLSB2KSAmJiBhLnNhbmUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2tcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeiA9IF8sICh4ID0gMCkgPT09IGYpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHggKz0gaCAtIHYsIHYgPCBrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGsgLT0gdjsgU1tyKytdID0gX1t4KytdLCAtLXY7KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggPSByIC0geSwgeiA9IFNcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZiA8IHYpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHggKz0gaCArIGYgLSB2LCAodiAtPSBmKSA8IGspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoayAtPSB2OyBTW3IrK10gPSBfW3grK10sIC0tdjspO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHggPSAwLCBmIDwgaykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoayAtPSB2ID0gZjsgU1tyKytdID0gX1t4KytdLCAtLXY7KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ID0gciAtIHksIHogPSBTXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHggKz0gZiAtIHYsIHYgPCBrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoayAtPSB2OyBTW3IrK10gPSBfW3grK10sIC0tdjspO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ID0gciAtIHksIHogPSBTXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyAyIDwgazspIFNbcisrXSA9IHpbeCsrXSwgU1tyKytdID0gelt4KytdLCBTW3IrK10gPSB6W3grK10sIGsgLT0gMztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrICYmIChTW3IrK10gPSB6W3grK10sIDEgPCBrICYmIChTW3IrK10gPSB6W3grK10pKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHggPSByIC0geTsgU1tyKytdID0gU1t4KytdLCBTW3IrK10gPSBTW3grK10sIFNbcisrXSA9IFNbeCsrXSwgMiA8IChrIC09IDMpOyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgayAmJiAoU1tyKytdID0gU1t4KytdLCAxIDwgayAmJiAoU1tyKytdID0gU1t4KytdKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSB3aGlsZSAoaSA8IG4gJiYgciA8IG8pO1xcbiAgICAgICAgICAgICAgICBpIC09IGsgPSBjID4+IDMsIHUgJj0gKDEgPDwgKGMgLT0gayA8PCAzKSkgLSAxLCB0Lm5leHRfaW4gPSBpLCB0Lm5leHRfb3V0ID0gciwgdC5hdmFpbF9pbiA9IGkgPCBuID8gbiAtIGkgKyA1IDogNSAtIChpIC0gbiksIHQuYXZhaWxfb3V0ID0gciA8IG8gPyBvIC0gciArIDI1NyA6IDI1NyAtIChyIC0gbyksIGEuaG9sZCA9IHUsIGEuYml0cyA9IGNcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCB7fV0sXFxuICAgICAgICAxMTogW2Z1bmN0aW9uKHQsIGUsIGEpIHtcXG4gICAgICAgICAgICBcXFwidXNlIHN0cmljdFxcXCI7XFxuICAgICAgICAgICAgdmFyIFogPSB0KFxcXCIuLi91dGlscy9jb21tb25cXFwiKSxcXG4gICAgICAgICAgICAgICAgUiA9IHQoXFxcIi4vYWRsZXIzMlxcXCIpLFxcbiAgICAgICAgICAgICAgICBDID0gdChcXFwiLi9jcmMzMlxcXCIpLFxcbiAgICAgICAgICAgICAgICBOID0gdChcXFwiLi9pbmZmYXN0XFxcIiksXFxuICAgICAgICAgICAgICAgIE8gPSB0KFxcXCIuL2luZnRyZWVzXFxcIiksXFxuICAgICAgICAgICAgICAgIEQgPSAxLFxcbiAgICAgICAgICAgICAgICBJID0gMixcXG4gICAgICAgICAgICAgICAgVSA9IDAsXFxuICAgICAgICAgICAgICAgIFQgPSAtMixcXG4gICAgICAgICAgICAgICAgRiA9IDEsXFxuICAgICAgICAgICAgICAgIGkgPSA4NTIsXFxuICAgICAgICAgICAgICAgIG4gPSA1OTI7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gTCh0KSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAodCA+Pj4gMjQgJiAyNTUpICsgKHQgPj4+IDggJiA2NTI4MCkgKyAoKDY1MjgwICYgdCkgPDwgOC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AgICBmdW5jdGlvbiBoKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGEsIGk7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0ID8gKGkgPSBuZXcgciwgKHQuc3RhdGUgPSBpKS53aW5kb3cgPSBudWxsLCAoYSA9IGwodCwgZSkpICE9PSBVICYmICh0LnN0YXRlID0gbnVsbCksIGEpIDogVFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB2YXIgZCwgZiwgXyA9ICEwO1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIEgodCkge1xcbiAgICAgICAgICAgICAgICBpZiAoXykge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGU7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGQgPSBuZXcgWi5CdWYzMig1MTIpLCBmID0gbmV3IFouQnVmMzIoMzIpLCBlID0gMDsgZSA8IDE0NDspIHQubGVuc1tlKytdID0gODtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoOyBlIDwgMjU2OykgdC5sZW5zW2UrK10gPSA5O1xcbiAgICAgICAgICAgICAgICAgICAgZm9yICg7IGUgPCAyODA7KSB0LmxlbnNbZSsrXSA9IDc7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZSA8IDI4ODspIHQubGVuc1tlKytdID0gODtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoTyhELCB0LmxlbnMsIDAsIDI4OCwgZCwgMCwgdC53b3JrLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpdHM6IDlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSwgZSA9IDA7IGUgPCAzMjspIHQubGVuc1tlKytdID0gNTtcXG4gICAgICAgICAgICAgICAgICAgIE8oSSwgdC5sZW5zLCAwLCAzMiwgZiwgMCwgdC53b3JrLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYml0czogNVxcbiAgICAgICAgICAgICAgICAgICAgfSksIF8gPSAhMVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHQubGVuY29kZSA9IGQsIHQubGVuYml0cyA9IDksIHQuZGlzdGNvZGUgPSBmLCB0LmRpc3RiaXRzID0gNVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBqKHQsIGUsIGEsIGkpIHtcXG4gICAgICAgICAgICAgICAgdmFyIG4sIHIgPSB0LnN0YXRlO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gci53aW5kb3cgJiYgKHIud3NpemUgPSAxIDw8IHIud2JpdHMsIHIud25leHQgPSAwLCByLndoYXZlID0gMCwgci53aW5kb3cgPSBuZXcgWi5CdWY4KHIud3NpemUpKSwgaSA+PSByLndzaXplID8gKFouYXJyYXlTZXQoci53aW5kb3csIGUsIGEgLSByLndzaXplLCByLndzaXplLCAwKSwgci53bmV4dCA9IDAsIHIud2hhdmUgPSByLndzaXplKSA6IChpIDwgKG4gPSByLndzaXplIC0gci53bmV4dCkgJiYgKG4gPSBpKSwgWi5hcnJheVNldChyLndpbmRvdywgZSwgYSAtIGksIG4sIHIud25leHQpLCAoaSAtPSBuKSA/IChaLmFycmF5U2V0KHIud2luZG93LCBlLCBhIC0gaSwgaSwgMCksIHIud25leHQgPSBpLCByLndoYXZlID0gci53c2l6ZSkgOiAoci53bmV4dCArPSBuLCByLnduZXh0ID09PSByLndzaXplICYmIChyLnduZXh0ID0gMCksIHIud2hhdmUgPCByLndzaXplICYmIChyLndoYXZlICs9IG4pKSksIDBcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYS5pbmZsYXRlUmVzZXQgPSBvLCBhLmluZmxhdGVSZXNldDIgPSBsLCBhLmluZmxhdGVSZXNldEtlZXAgPSBzLCBhLmluZmxhdGVJbml0ID0gZnVuY3Rpb24odCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gaCh0LCAxNSlcXG4gICAgICAgICAgICB9LCBhLmluZmxhdGVJbml0MiA9IGgsIGEuaW5mbGF0ZSA9IGZ1bmN0aW9uKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGEsIGksIG4sIHIsIHMsIG8sIGwsIGgsIGQsIGYsIF8sIHUsIGMsIGIsIGcsIG0sIHcsIHAsIHYsIGssIHksIHgsIHosIEIsIFMgPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgRSA9IG5ldyBaLkJ1ZjgoNCksXFxuICAgICAgICAgICAgICAgICAgICBBID0gWzE2LCAxNywgMTgsIDAsIDgsIDcsIDksIDYsIDEwLCA1LCAxMSwgNCwgMTIsIDMsIDEzLCAyLCAxNCwgMSwgMTVdO1xcbiAgICAgICAgICAgICAgICBpZiAoIXQgfHwgIXQuc3RhdGUgfHwgIXQub3V0cHV0IHx8ICF0LmlucHV0ICYmIDAgIT09IHQuYXZhaWxfaW4pIHJldHVybiBUO1xcbiAgICAgICAgICAgICAgICAxMiA9PT0gKGEgPSB0LnN0YXRlKS5tb2RlICYmIChhLm1vZGUgPSAxMyksIHMgPSB0Lm5leHRfb3V0LCBuID0gdC5vdXRwdXQsIGwgPSB0LmF2YWlsX291dCwgciA9IHQubmV4dF9pbiwgaSA9IHQuaW5wdXQsIG8gPSB0LmF2YWlsX2luLCBoID0gYS5ob2xkLCBkID0gYS5iaXRzLCBmID0gbywgXyA9IGwsIHggPSBVO1xcbiAgICAgICAgICAgICAgICB0OiBmb3IgKDs7KSBzd2l0Y2ggKGEubW9kZSkge1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBGOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBhLndyYXApIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5tb2RlID0gMTM7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBkIDwgMTY7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoMiAmIGEud3JhcCAmJiAzNTYxNSA9PT0gaCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBFW2EuY2hlY2sgPSAwXSA9IDI1NSAmIGgsIEVbMV0gPSBoID4+PiA4ICYgMjU1LCBhLmNoZWNrID0gQyhhLmNoZWNrLCBFLCAyLCAwKSwgZCA9IGggPSAwLCBhLm1vZGUgPSAyO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5mbGFncyA9IDAsIGEuaGVhZCAmJiAoYS5oZWFkLmRvbmUgPSAhMSksICEoMSAmIGEud3JhcCkgfHwgKCgoMjU1ICYgaCkgPDwgOCkgKyAoaCA+PiA4KSkgJSAzMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1zZyA9IFxcXCJpbmNvcnJlY3QgaGVhZGVyIGNoZWNrXFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICg4ICE9ICgxNSAmIGgpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubXNnID0gXFxcInVua25vd24gY29tcHJlc3Npb24gbWV0aG9kXFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkIC09IDQsIHkgPSA4ICsgKDE1ICYgKGggPj4+PSA0KSksIDAgPT09IGEud2JpdHMpIGEud2JpdHMgPSB5O1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHkgPiBhLndiaXRzKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubXNnID0gXFxcImludmFsaWQgd2luZG93IHNpemVcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYS5kbWF4ID0gMSA8PCB5LCB0LmFkbGVyID0gYS5jaGVjayA9IDEsIGEubW9kZSA9IDUxMiAmIGggPyAxMCA6IDEyLCBkID0gaCA9IDA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDI6XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGQgPCAxNjspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8tLSwgaCArPSBpW3IrK10gPDwgZCwgZCArPSA4XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmZsYWdzID0gaCwgOCAhPSAoMjU1ICYgYS5mbGFncykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwidW5rbm93biBjb21wcmVzc2lvbiBtZXRob2RcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDU3MzQ0ICYgYS5mbGFncykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1zZyA9IFxcXCJ1bmtub3duIGhlYWRlciBmbGFncyBzZXRcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYS5oZWFkICYmIChhLmhlYWQudGV4dCA9IGggPj4gOCAmIDEpLCA1MTIgJiBhLmZsYWdzICYmIChFWzBdID0gMjU1ICYgaCwgRVsxXSA9IGggPj4+IDggJiAyNTUsIGEuY2hlY2sgPSBDKGEuY2hlY2ssIEUsIDIsIDApKSwgZCA9IGggPSAwLCBhLm1vZGUgPSAzO1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBkIDwgMzI7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBhLmhlYWQgJiYgKGEuaGVhZC50aW1lID0gaCksIDUxMiAmIGEuZmxhZ3MgJiYgKEVbMF0gPSAyNTUgJiBoLCBFWzFdID0gaCA+Pj4gOCAmIDI1NSwgRVsyXSA9IGggPj4+IDE2ICYgMjU1LCBFWzNdID0gaCA+Pj4gMjQgJiAyNTUsIGEuY2hlY2sgPSBDKGEuY2hlY2ssIEUsIDQsIDApKSwgZCA9IGggPSAwLCBhLm1vZGUgPSA0O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA0OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBkIDwgMTY7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBhLmhlYWQgJiYgKGEuaGVhZC54ZmxhZ3MgPSAyNTUgJiBoLCBhLmhlYWQub3MgPSBoID4+IDgpLCA1MTIgJiBhLmZsYWdzICYmIChFWzBdID0gMjU1ICYgaCwgRVsxXSA9IGggPj4+IDggJiAyNTUsIGEuY2hlY2sgPSBDKGEuY2hlY2ssIEUsIDIsIDApKSwgZCA9IGggPSAwLCBhLm1vZGUgPSA1O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA1OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxMDI0ICYgYS5mbGFncykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZCA8IDE2Oykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubGVuZ3RoID0gaCwgYS5oZWFkICYmIChhLmhlYWQuZXh0cmFfbGVuID0gaCksIDUxMiAmIGEuZmxhZ3MgJiYgKEVbMF0gPSAyNTUgJiBoLCBFWzFdID0gaCA+Pj4gOCAmIDI1NSwgYS5jaGVjayA9IEMoYS5jaGVjaywgRSwgMiwgMCkpLCBkID0gaCA9IDBcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgYS5oZWFkICYmIChhLmhlYWQuZXh0cmEgPSBudWxsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBhLm1vZGUgPSA2O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA2OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgx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PSAwLCBhLm1vZGUgPSA4O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA4OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICg0MDk2ICYgYS5mbGFncykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gbykgYnJlYWsgdDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh1ID0gMDsgeSA9IGlbciArIHUrK10sIGEuaGVhZCAmJiB5ICYmIGEubGVuZ3RoIDwgNjU1MzYgJiYgKGEuaGVhZC5jb21tZW50ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoeSkpLCB5ICYmIHUgPCBvOyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg1MTIgJiBhLmZsYWdzICYmIChhLmNoZWNrID0gQyhhLmNoZWNrLCBpLCB1LCByKSksIG8gLT0gdSwgciArPSB1LCB5KSBicmVhayB0XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGEuaGVhZCAmJiAoYS5oZWFkLmNvbW1lbnQgPSBudWxsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBhLm1vZGUgPSA5O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA5OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICg1MTIgJiBhLmZsYWdzKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBkIDwgMTY7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gbykgYnJlYWsgdDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8tLSwgaCArPSBpW3IrK10gPDwgZCwgZCArPSA4XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGggIT09ICg2NTUzNSAmIGEuY2hlY2spKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1zZyA9IFxcXCJoZWFkZXIgY3JjIG1pc21hdGNoXFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBoID0gMFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBhLmhlYWQgJiYgKGEuaGVhZC5oY3JjID0gYS5mbGFncyA+PiA5ICYgMSwgYS5oZWFkLmRvbmUgPSAhMCksIHQuYWRsZXIgPSBhLmNoZWNrID0gMCwgYS5tb2RlID0gMTI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDEwOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBkIDwgMzI7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB0LmFkbGVyID0gYS5jaGVjayA9IEwoaCksIGQgPSBoID0gMCwgYS5tb2RlID0gMTE7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDExOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBhLmhhdmVkaWN0KSByZXR1cm4gdC5uZXh0X291dCA9IHMsIHQuYXZhaWxfb3V0ID0gbCwgdC5uZXh0X2luID0gciwgdC5hdmFpbF9pbiA9IG8sIGEuaG9sZCA9IGgsIGEuYml0cyA9IGQsIDI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdC5hZGxlciA9IGEuY2hlY2sgPSAxLCBhLm1vZGUgPSAxMjtcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDUgPT09IGUgfHwgNiA9PT0gZSkgYnJlYWsgdDtcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTM6XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEubGFzdCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID4+Pj0gNyAmIGQsIGQgLT0gNyAmIGQsIGEubW9kZSA9IDI3O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZCA8IDM7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGEubGFzdCA9IDEgJiBoLCBkIC09IDEsIDMgJiAoaCA+Pj49IDEpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubW9kZSA9IDE0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChIKGEpLCBhLm1vZGUgPSAyMCwgNiAhPT0gZSkgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID4+Pj0gMiwgZCAtPSAyO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5tb2RlID0gMTc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW52YWxpZCBibG9jayB0eXBlXFxcIiwgYS5tb2RlID0gMzBcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgaCA+Pj49IDIsIGQgLT0gMjtcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChoID4+Pj0gNyAmIGQsIGQgLT0gNyAmIGQ7IGQgPCAzMjspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8tLSwgaCArPSBpW3IrK10gPDwgZCwgZCArPSA4XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoNjU1MzUgJiBoKSAhPSAoaCA+Pj4gMTYgXiA2NTUzNSkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW52YWxpZCBzdG9yZWQgYmxvY2sgbGVuZ3Roc1xcXCIsIGEubW9kZSA9IDMwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5sZW5ndGggPSA2NTUzNSAmIGgsIGQgPSBoID0gMCwgYS5tb2RlID0gMTUsIDYgPT09IGUpIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDE1OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGEubW9kZSA9IDE2O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxNjpcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodSA9IGEubGVuZ3RoKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvIDwgdSAmJiAodSA9IG8pLCBsIDwgdSAmJiAodSA9IGwpLCAwID09PSB1KSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBaLmFycmF5U2V0KG4sIGksIHIsIHUsIHMpLCBvIC09IHUsIHIgKz0gdSwgbCAtPSB1LCBzICs9IHUsIGEubGVuZ3RoIC09IHU7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGEubW9kZSA9IDEyO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxNzpcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZCA8IDE0Oykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gbykgYnJlYWsgdDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgby0tLCBoICs9IGlbcisrXSA8PCBkLCBkICs9IDhcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEubmxlbiA9IDI1NyArICgzMSAmIGgpLCBoID4+Pj0gNSwgZCAtPSA1LCBhLm5kaXN0ID0gMSArICgzMSAmIGgpLCBoID4+Pj0gNSwgZCAtPSA1LCBhLm5jb2RlID0gNCArICgxNSAmIGgpLCBoID4+Pj0gNCwgZCAtPSA0LCAyODYgPCBhLm5sZW4gfHwgMzAgPCBhLm5kaXN0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubXNnID0gXFxcInRvbyBtYW55IGxlbmd0aCBvciBkaXN0YW5jZSBzeW1ib2xzXFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGEuaGF2ZSA9IDAsIGEubW9kZSA9IDE4O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxODpcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgYS5oYXZlIDwgYS5uY29kZTspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGQgPCAzOykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubGVuc1tBW2EuaGF2ZSsrXV0gPSA3ICYgaCwgaCA+Pj49IDMsIGQgLT0gM1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgYS5oYXZlIDwgMTk7KSBhLmxlbnNbQVthLmhhdmUrK11dID0gMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5sZW5jb2RlID0gYS5sZW5keW4sIGEubGVuYml0cyA9IDcsIHogPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRzOiBhLmxlbmJpdHNcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeCA9IE8oMCwgYS5sZW5zLCAwLCAxOSwgYS5sZW5jb2RlLCAwLCBhLndvcmssIHopLCBhLmxlbmJpdHMgPSB6LmJpdHMsIHgpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW52YWxpZCBjb2RlIGxlbmd0aHMgc2V0XFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGEuaGF2ZSA9IDAsIGEubW9kZSA9IDE5O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxOTpcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgYS5oYXZlIDwgYS5ubGVuICsgYS5uZGlzdDspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IG0gPSAoUyA9IGEubGVuY29kZVtoICYgKDEgPDwgYS5sZW5iaXRzKSAtIDFdKSA+Pj4gMTYgJiAyNTUsIHcgPSA2NTUzNSAmIFMsICEoKGcgPSBTID4+PiAyNCkgPD0gZCk7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gbykgYnJlYWsgdDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8tLSwgaCArPSBpW3IrK10gPDwgZCwgZCArPSA4XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHcgPCAxNikgaCA+Pj49IGcsIGQgLT0gZywgYS5sZW5zW2EuaGF2ZSsrXSA9IHc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDE2ID09PSB3KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChCID0gZyArIDI7IGQgPCBCOykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gbykgYnJlYWsgdDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby0tLCBoICs9IGlbcisrXSA8PCBkLCBkICs9IDhcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGggPj4+PSBnLCBkIC09IGcsIDAgPT09IGEuaGF2ZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1zZyA9IFxcXCJpbnZhbGlkIGJpdCBsZW5ndGggcmVwZWF0XFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkgPSBhLmxlbnNbYS5oYXZlIC0gMV0sIHUgPSAzICsgKDMgJiBoKSwgaCA+Pj49IDIsIGQgLT0gMlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgxNyA9PT0gdykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoQiA9IGcgKyAzOyBkIDwgQjspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8tLSwgaCArPSBpW3IrK10gPDwgZCwgZCArPSA4XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgLT0gZywgeSA9IDAsIHUgPSAzICsgKDcgJiAoaCA+Pj49IGcpKSwgaCA+Pj49IDMsIGQgLT0gM1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKEIgPSBnICsgNzsgZCA8IEI7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkIC09IGcsIHkgPSAwLCB1ID0gMTEgKyAoMTI3ICYgKGggPj4+PSBnKSksIGggPj4+PSA3LCBkIC09IDdcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmhhdmUgKyB1ID4gYS5ubGVuICsgYS5uZGlzdCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubXNnID0gXFxcImludmFsaWQgYml0IGxlbmd0aCByZXBlYXRcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHUtLTspIGEubGVuc1thLmhhdmUrK10gPSB5XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDMwID09PSBhLm1vZGUpIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBhLmxlbnNbMjU2XSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1zZyA9IFxcXCJpbnZhbGlkIGNvZGUgLS0gbWlzc2luZyBlbmQtb2YtYmxvY2tcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEubGVuYml0cyA9IDksIHogPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRzOiBhLmxlbmJpdHNcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeCA9IE8oRCwgYS5sZW5zLCAwLCBhLm5sZW4sIGEubGVuY29kZSwgMCwgYS53b3JrLCB6KSwgYS5sZW5iaXRzID0gei5iaXRzLCB4KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubXNnID0gXFxcImludmFsaWQgbGl0ZXJhbC9sZW5ndGhzIHNldFxcXCIsIGEubW9kZSA9IDMwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5kaXN0Yml0cyA9IDYsIGEuZGlzdGNvZGUgPSBhLmRpc3RkeW4sIHogPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRzOiBhLmRpc3RiaXRzXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHggPSBPKEksIGEubGVucywgYS5ubGVuLCBhLm5kaXN0LCBhLmRpc3Rjb2RlLCAwLCBhLndvcmssIHopLCBhLmRpc3RiaXRzID0gei5iaXRzLCB4KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubXNnID0gXFxcImludmFsaWQgZGlzdGFuY2VzIHNldFxcXCIsIGEubW9kZSA9IDMwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5tb2RlID0gMjAsIDYgPT09IGUpIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDIwOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGEubW9kZSA9IDIxO1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyMTpcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoNiA8PSBvICYmIDI1OCA8PSBsKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubmV4dF9vdXQgPSBzLCB0LmF2YWlsX291dCA9IGwsIHQubmV4dF9pbiA9IHIsIHQuYXZhaWxfaW4gPSBvLCBhLmhvbGQgPSBoLCBhLmJpdHMgPSBkLCBOKHQsIF8pLCBzID0gdC5uZXh0X291dCwgbiA9IHQub3V0cHV0LCBsID0gdC5hdmFpbF9vdXQsIHIgPSB0Lm5leHRfaW4sIGkgPSB0LmlucHV0LCBvID0gdC5hdmFpbF9pbiwgaCA9IGEuaG9sZCwgZCA9IGEuYml0cywgMTIgPT09IGEubW9kZSAmJiAoYS5iYWNrID0gLTEpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEuYmFjayA9IDA7IG0gPSAoUyA9IGEubGVuY29kZVtoICYgKDEgPDwgYS5sZW5iaXRzKSAtIDFdKSA+Pj4gMTYgJiAyNTUsIHcgPSA2NTUzNSAmIFMsICEoKGcgPSBTID4+PiAyNCkgPD0gZCk7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobSAmJiAwID09ICgyNDAgJiBtKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHAgPSBnLCB2ID0gbSwgayA9IHc7IG0gPSAoUyA9IGEubGVuY29kZVtrICsgKChoICYgKDEgPDwgcCArIHYpIC0gMSkgPj4gcCldKSA+Pj4gMTYgJiAyNTUsIHcgPSA2NTUzNSAmIFMsICEocCArIChnID0gUyA+Pj4gMjQpIDw9IGQpOykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPj4+PSBwLCBkIC09IHAsIGEuYmFjayArPSBwXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoID4+Pj0gZywgZCAtPSBnLCBhLmJhY2sgKz0gZywgYS5sZW5ndGggPSB3LCAwID09PSBtKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubW9kZSA9IDI2O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoMzIgJiBtKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuYmFjayA9IC0xLCBhLm1vZGUgPSAxMjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDY0ICYgbSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1zZyA9IFxcXCJpbnZhbGlkIGxpdGVyYWwvbGVuZ3RoIGNvZGVcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYS5leHRyYSA9IDE1ICYgbSwgYS5tb2RlID0gMjI7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDIyOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmV4dHJhKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoQiA9IGEuZXh0cmE7IGQgPCBCOykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubGVuZ3RoICs9IGggJiAoMSA8PCBhLmV4dHJhKSAtIDEsIGggPj4+PSBhLmV4dHJhLCBkIC09IGEuZXh0cmEsIGEuYmFjayArPSBhLmV4dHJhXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGEud2FzID0gYS5sZW5ndGgsIGEubW9kZSA9IDIzO1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyMzpcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbSA9IChTID0gYS5kaXN0Y29kZVtoICYgKDEgPDwgYS5kaXN0Yml0cykgLSAxXSkgPj4+IDE2ICYgMjU1LCB3ID0gNjU1MzUgJiBTLCAhKChnID0gUyA+Pj4gMjQpIDw9IGQpOykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gbykgYnJlYWsgdDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgby0tLCBoICs9IGlbcisrXSA8PCBkLCBkICs9IDhcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT0gKDI0MCAmIG0pKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocCA9IGcsIHYgPSBtLCBrID0gdzsgbSA9IChTID0gYS5kaXN0Y29kZVtrICsgKChoICYgKDEgPDwgcCArIHYpIC0gMSkgPj4gcCldKSA+Pj4gMTYgJiAyNTUsIHcgPSA2NTUzNSAmIFMsICEocCArIChnID0gUyA+Pj4gMjQpIDw9IGQpOykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPj4+PSBwLCBkIC09IHAsIGEuYmFjayArPSBwXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoID4+Pj0gZywgZCAtPSBnLCBhLmJhY2sgKz0gZywgNjQgJiBtKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubXNnID0gXFxcImludmFsaWQgZGlzdGFuY2UgY29kZVxcXCIsIGEubW9kZSA9IDMwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBhLm9mZnNldCA9IHcsIGEuZXh0cmEgPSAxNSAmIG0sIGEubW9kZSA9IDI0O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyNDpcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5leHRyYSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKEIgPSBhLmV4dHJhOyBkIDwgQjspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby0tLCBoICs9IGlbcisrXSA8PCBkLCBkICs9IDhcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLm9mZnNldCArPSBoICYgKDEgPDwgYS5leHRyYSkgLSAxLCBoID4+Pj0gYS5leHRyYSwgZCAtPSBhLmV4dHJhLCBhLmJhY2sgKz0gYS5leHRyYVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5vZmZzZXQgPiBhLmRtYXgpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2tcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYS5tb2RlID0gMjU7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDI1OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBsKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1ID0gXyAtIGwsIGEub2Zmc2V0ID4gdSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHUgPSBhLm9mZnNldCAtIHUpID4gYS53aGF2ZSAmJiBhLnNhbmUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubXNnID0gXFxcImludmFsaWQgZGlzdGFuY2UgdG9vIGZhciBiYWNrXFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPiBhLnduZXh0ID8gKHUgLT0gYS53bmV4dCwgYyA9IGEud3NpemUgLSB1KSA6IGMgPSBhLnduZXh0IC0gdSwgdSA+IGEubGVuZ3RoICYmICh1ID0gYS5sZW5ndGgpLCBiID0gYS53aW5kb3dcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgYiA9IG4sIGMgPSBzIC0gYS5vZmZzZXQsIHUgPSBhLmxlbmd0aDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGwgPCB1ICYmICh1ID0gbCksIGwgLT0gdSwgYS5sZW5ndGggLT0gdTsgbltzKytdID0gYltjKytdLCAtLXU7KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAwID09PSBhLmxlbmd0aCAmJiAoYS5tb2RlID0gMjEpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyNjpcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gbCkgYnJlYWsgdDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBuW3MrK10gPSBhLmxlbmd0aCwgbC0tLCBhLm1vZGUgPSAyMTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMjc6XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEud3JhcCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZCA8IDMyOykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggfD0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChfIC09IGwsIHQudG90YWxfb3V0ICs9IF8sIGEudG90YWwgKz0gXywgXyAmJiAodC5hZGxlciA9IGEuY2hlY2sgPSBhLmZsYWdzID8gQyhhLmNoZWNrLCBuLCBfLCBzIC0gXykgOiBSKGEuY2hlY2ssIG4sIF8sIHMgLSBfKSksIF8gPSBsLCAoYS5mbGFncyA/IGggOiBMKGgpKSAhPT0gYS5jaGVjaykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW5jb3JyZWN0IGRhdGEgY2hlY2tcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGggPSAwXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGEubW9kZSA9IDI4O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyODpcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS53cmFwICYmIGEuZmxhZ3MpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGQgPCAzMjspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby0tLCBoICs9IGlbcisrXSA8PCBkLCBkICs9IDhcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCAhPT0gKDQyOTQ5NjcyOTUgJiBhLnRvdGFsKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW5jb3JyZWN0IGxlbmd0aCBjaGVja1xcXCIsIGEubW9kZSA9IDMwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gaCA9IDBcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYS5tb2RlID0gMjk7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDI5OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIHggPSAxO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDMwOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIHggPSAtMztcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAzMTpcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTQ7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDMyOlxcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVFxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiB0Lm5leHRfb3V0ID0gcywgdC5hdmFpbF9vdXQgPSBsLCB0Lm5leHRfaW4gPSByLCB0LmF2YWlsX2luID0gbywgYS5ob2xkID0gaCwgYS5iaXRzID0gZCwgKGEud3NpemUgfHwgXyAhPT0gdC5hdmFpbF9vdXQgJiYgYS5tb2RlIDwgMzAgJiYgKGEubW9kZSA8IDI3IHx8IDQgIT09IGUpKSAmJiBqKHQsIHQub3V0cHV0LCB0Lm5leHRfb3V0LCBfIC0gdC5hdmFpbF9vdXQpID8gKGEubW9kZSA9IDMxLCAtNCkgOiAoZiAtPSB0LmF2YWlsX2luLCBfIC09IHQuYXZhaWxfb3V0LCB0LnRvdGFsX2luICs9IGYsIHQudG90YWxfb3V0ICs9IF8sIGEudG90YWwgKz0gXywgYS53cmFwICYmIF8gJiYgKHQuYWRsZXIgPSBhLmNoZWNrID0gYS5mbG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CA0LCA1LCA3LCA5LCAxMywgMTcsIDI1LCAzMywgNDksIDY1LCA5NywgMTI5LCAxOTMsIDI1NywgMzg1LCA1MTMsIDc2OSwgMTAyNSwgMTUzNywgMjA0OSwgMzA3MywgNDA5NywgNjE0NSwgODE5MywgMTIyODksIDE2Mzg1LCAyNDU3NywgMCwgMF0sXFxuICAgICAgICAgICAgICAgIEYgPSBbMTYsIDE2LCAxNiwgMTYsIDE3LCAxNywgMTgsIDE4LCAxOSwgMTksIDIwLCAyMCwgMjEsIDIxLCAyMiwgMjIsIDIzLCAyMywgMjQsIDI0LCAyNSwgMjUsIDI2LCAyNiwgMjcsIDI3LCAyOCwgMjgsIDI5LCAyOSwgNjQsIDY0XTtcXG4gICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbih0LCBlLCBhLCBpLCBuLCByLCBzLCBvKSB7XFxuICAgICAgICAgICAgICAgIHZhciBsLCBoLCBkLCBmLCBfLCB1LCBjLCBiLCBnLCBtID0gby5iaXRzLFxcbiAgICAgICAgICAgICAgICAgICAgdyA9IDAsXFxuICAgICAgICAgICAgICAgICAgICBwID0gMCxcXG4gICAgICAgICAgICAgICAgICAgIHYgPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgayA9IDAsXFxuICAgICAgICAgICAgICAgICAgICB5ID0gMCxcXG4gICAgICAgICAgICAgICAgICAgIHggPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgeiA9IDAsXFxuICAgICAgICAgICAgICAgICAgICBCID0gMCxcXG4gICAgICAgICAgICAgICAgICAgIFMgPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgRSA9IDAsXFxuICAgICAgICAgICAgICAgICAgICBBID0gbnVsbCxcXG4gICAgICAgICAgICAgICAgICAgIFogPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgUiA9IG5ldyBELkJ1ZjE2KDE2KSxcXG4gICAgICAgICAgICAgICAgICAgIEMgPSBuZXcgRC5CdWYxNigxNiksXFxuICAgICAgICAgICAgICAgICAgICBOID0gbnVsbCxcXG4gICAgICAgICAgICAgICAgICAgIE8gPSAwO1xcbiAgICAgICAgICAgICAgICBmb3IgKHcgPSAwOyB3IDw9IDE1OyB3KyspIFJbd10gPSAwO1xcbiAgICAgICAgICAgICAgICBmb3IgKHAgPSAwOyBwIDwgaTsgcCsrKSBSW2VbYSArIHBdXSsrO1xcbiAgICAgICAgICAgICAgICBmb3IgKHkgPSBtLCBrID0gMTU7IDEgPD0gayAmJiAwID09PSBSW2tdOyBrLS0pO1xcbiAgICAgICAgICAgICAgICBpZiAoayA8IHkgJiYgKHkgPSBrKSwgMCA9PT0gaykgcmV0dXJuIG5bcisrXSA9IDIwOTcxNTIwLCBuW3IrK10gPSAyMDk3MTUyMCwgby5iaXRzID0gMSwgMDtcXG4gICAgICAgICAgICAgICAgZm9yICh2ID0gMTsgdiA8IGsgJiYgMCA9PT0gUlt2XTsgdisrKTtcXG4gICAgICAgICAgICAgICAgZm9yICh5IDwgdiAmJiAoeSA9IHYpLCB3ID0gQiA9IDE7IHcgPD0gMTU7IHcrKylcXG4gICAgICAgICAgICAgICAgICAgIGlmIChCIDw8PSAxLCAoQiAtPSBSW3ddKSA8IDApIHJldHVybiAtMTtcXG4gICAgICAgICAgICAgICAgaWYgKDAgPCBCICYmICgwID09PSB0IHx8IDEgIT09IGspKSByZXR1cm4gLTE7XFxuICAgICAgICAgICAgICAgIGZvciAoQ1sxXSA9IDAsIHcgPSAxOyB3IDwgMTU7IHcrKykgQ1t3ICsgMV0gPSBDW3ddICsgUlt3XTtcXG4gICAgICAgICAgICAgICAgZm9yIChwID0gMDsgcCA8IGk7IHArKykgMCAhPT0gZVthICsgcF0gJiYgKHNbQ1tlW2EgKyBwXV0rK10gPSBwKTtcXG4gICAgICAgICAgICAgICAgaWYgKDAgPT09IHQgPyAoQSA9IE4gPSBzLCB1ID0gMTkpIDogMSA9PT0gdCA/IChBID0gSSwgWiAtPSAyNTcsIE4gPSBVLCBPIC09IDI1NywgdSA9IDI1NikgOiAoQSA9IFQsIE4gPSBGLCB1ID0gLTEpLCB3ID0gdiwgXyA9IHIsIHogPSBwID0gRSA9IDAsIGQgPSAtMSwgZiA9IChTID0gMSA8PCAoeCA9IHkpKSAtIDEsIDEgPT09IHQgJiYgODUyIDwgUyB8fCAyID09PSB0ICYmIDU5MiA8IFMpIHJldHVybiAxO1xcbiAgICAgICAgICAgICAgICBmb3IgKDs7KSB7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSB3IC0geiwgc1twXSA8IHUgPyAoYiA9IDAsIGcgPSBzW3BdKSA6IHNbcF0gPiB1ID8gKGIgPSBOW08gKyBzW3BdXSwgZyA9IEFbWiArIHNbcF1dKSA6IChiID0gOTYsIGcgPSAwKSwgbCA9IDEgPDwgdyAtIHosIHYgPSBoID0gMSA8PCB4OyBuW18gKyAoRSA+PiB6KSArIChoIC09IGwpXSA9IGMgPDwgMjQgfCBiIDw8IDE2IHwgZyB8IDAsIDAgIT09IGg7KTtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAobCA9IDEgPDwgdyAtIDE7IEUgJiBsOykgbCA+Pj0gMTtcXG4gICAgICAgICAgICAgICAgICAgIGlmICgwICE9PSBsID8gKEUgJj0gbCAtIDEsIEUgKz0gbCkgOiBFID0gMCwgcCsrLCAwID09IC0tUlt3XSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3ID09PSBrKSBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICB3ID0gZVthICsgc1twXV1cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGlmICh5IDwgdyAmJiAoRSAmIGYpICE9PSBkKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yICgwID09PSB6ICYmICh6ID0geSksIF8gKz0gdiwgQiA9IDEgPDwgKHggPSB3IC0geik7IHggKyB6IDwgayAmJiAhKChCIC09IFJbeCArIHpdKSA8PSAwKTspIHgrKywgQiA8PD0gMTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoUyArPSAxIDw8IHgsIDEgPT09IHQgJiYgODUyIDwgUyB8fCAyID09PSB0ICYmIDU5MiA8IFMpIHJldHVybiAxO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIG5bZCA9IEUgJiBmXSA9IHkgPDwgMjQgfCB4IDw8IDE2IHwgXyAtIHIgfCAwXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIDAgIT09IEUgJiYgKG5bXyArIEVdID0gdyAtIHogPDwgMjQgfCA2NCA8PCAxNiB8IDApLCBvLmJpdHMgPSB5LCAwXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgIFxcXCIuLi91dGlscy9jb21tb25cXFwiOiAzXFxuICAgICAgICB9XSxcXG4gICAgICAgIDEzOiBbZnVuY3Rpb24odCwgZSwgYSkge1xcbiAgICAgICAgICAgIFxcXCJ1c2Ugc3RyaWN0XFxcIjtcXG4gICAgICAgICAgICBlLmV4cG9ydHMgPSB7XFxuICAgICAgICAgICAgICAgIDI6IFxcXCJuZWVkIGRpY3Rpb25hcnlcXFwiLFxcbiAgICAgICAgICAgICAgICAxOiBcXFwic3RyZWFtIGVuZFxcXCIsXFxuICAgICAgICAgICAgICAgIDA6IFxcXCJcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwiLTFcXFwiOiBcXFwiZmlsZSBlcnJvclxcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCItMlxcXCI6IFxcXCJzdHJlYW0gZXJyb3JcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwiLTNcXFwiOiBcXFwiZGF0YSBlcnJvclxcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCItNFxcXCI6IFxcXCJpbnN1ZmZpY2llbnQgbWVtb3J5XFxcIixcXG4gICAgICAgICAgICAgICAgXFxcIi01XFxcIjogXFxcImJ1ZmZlciBlcnJvclxcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCItNlxcXCI6IFxcXCJpbmNvbXBhdGlibGUgdmVyc2lvblxcXCJcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCB7fV0sXFxuICAgICAgICAxNDogW2Z1bmN0aW9uKHQsIGUsIGEpIHtcXG4gICAgICAgICAgICBcXFwidXNlIHN0cmljdFxcXCI7XFxuICAgICAgICAgICAgdmFyIGwgPSB0KFxcXCIuLi91dGlscy9jb21tb25cXFwiKSxcXG4gICAgICAgICAgICAgICAgbyA9IDAsXFxuICAgICAgICAgICAgICAgIGggPSAxO1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGkodCkge1xcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gdC5sZW5ndGg7IDAgPD0gLS1lOykgdFtlXSA9IDBcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdmFyIGQgPSAwLFxcbiAgICAgICAgICAgICAgICBzID0gMjksXFxuICAgICAgICAgICAgICAgIGYgPSAyNTYsXFxuICAgICAgICAgICAgICAgIF8gPSBmICsgMSArIHMsXFxuICAgICAgICAgICAgICAgIHUgPSAzMCxcXG4gICAgICAgICAgICAgICAgYyA9IDE5LFxcbiAgICAgICAgICAgICAgICBnID0gMiAqIF8gKyAxLFxcbiAgICAgICAgICAgICAgICBtID0gMTUsXFxuICAgICAgICAgICAgICAgIG4gPSAxNixcXG4gICAgICAgICAgICAgICAgYiA9IDcsXFxuICAgICAgICAgICAgICAgIHcgPSAyNTYsXFxuICAgICAgICAgICAgICAgIHAgPSAxNixcXG4gICAgICAgICAgICAgICAgdiA9IDE3LFxcbiAgICAgICAgICAgICAgICBrID0gMTgsXFxuICAgICAgICAgICAgICAgIHkgPSBbMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMSwgMSwgMSwgMSwgMiwgMiwgMiwgMiwgMywgMywgMywgMywgNCwgNCwgNCwgNCwgNSwgNSwgNSwgNSwgMF0sXFxuICAgICAgICAgICAgICAgI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SAxLCAwIDwgLS1lOyk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBhID4+PiAxXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGoodCwgZSwgYSkge1xcbiAgICAgICAgICAgICAgICB2YXIgaSwgbiwgciA9IG5ldyBBcnJheShtICsgMSksXFxuICAgICAgICAgICAgICAgICAgICBzID0gMDtcXG4gICAgICAgICAgICAgICAgZm9yIChpID0gMTsgaSA8PSBtOyBpKyspIHJbaV0gPSBzID0gcyArIGFbaSAtIDFdIDw8IDE7XFxuICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPD0gZTsgbisrKSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRbMiAqIG4gKyAxXTtcXG4gICAgICAgICAgICAgICAgICAgIDAgIT09IG8gJiYgKHRbMiAqIG5dID0gSChyW29dKyssIG8pKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIEsodCkge1xcbiAgICAgICAgICAgICAgICB2YXIgZTtcXG4gICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IF87IGUrKykgdC5keW5fbHRyZWVbMiAqIGVdID0gMDtcXG4gICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IHU7IGUrKykgdC5keW5fZHRyZWVbMiAqIGVdID0gMDtcXG4gICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IGM7IGUrKykgdC5ibF90cmVlWzIgKiBlXSA9IDA7XFxuICAgICAgICAgICAgICAgIHQuZHluX2x0cmVlWzIgKiB3XSA9IDEsIHQub3B0X2xlbiA9IHQuc3RhdGljX2xlbiA9IDAsIHQubGFzdF9saXQgPSB0Lm1hdGNoZXMgPSAwXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIE0odCkge1xcbiAgICAgICAgICAgICAgICA4IDwgdC5iaV92YWxpZCA/I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gPSB0LnBlbmRpbmdfYnVmW3QubF9idWYgKyBvXSwgbysrLCAwID09PSBpID8gTCh0LCBuLCBlKSA6IChMKHQsIChyID0gWltuXSkgKyBmICsgMSwgZSksIDAgIT09IChzID0geVtyXSkgJiYgRih0LCBuIC09IFJbcl0sIHMpLCBMKHQsIHIgPSBVKC0taSksIGEpLCAwICE9PSAocyA9IHhbcl0pICYmIEYodCwgaSAtPSBEW3JdLCBzKSksIG8gPCB0Lmxhc3RfbGl0Oyk7XFxuICAgICAgICAgICAgICAgIEwodCwgdywgZSlcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gRyh0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHZhciBhLCBpLCBuLCByID0gZS5keW5fdHJlZSxcXG4gICAgICAgICAgICAgICAgICAgIHMgPSBlLnN0YXRfZGVzYy5zdGF0aWNfdHJlZSxcXG4gICAgICAgICAgICAgICAgICAgIG8gPSBlLnN0YXRfZGVzYy5oYXNfc3RyZWUsXFxuICAgICAgICAgICAgICAgICAgICBsID0gZS5zdGF0X2Rlc2MuZWxlbXMsXFxuICAgICAgICAgICAgICAgICAgICBoID0gLTE7XFxuICAgICAgICAgICAgICAgIGZvciAodC5oZWFwX2xlbiA9IDAsIHQuaGVhcF9tYXggPSBnLCBhID0gMDsgYSA8IGw7IGErKykgMCAhPT0gclsyICogYV0gPyAodC5oZWFwWysrdC5oZWFwX2xlbl0gPSBoID0gYSwgdC5kZXB0aFthXSA9IDApIDogclsyICogYSArIDFdID0gMDtcXG4gICAgICAgICAgICAgICAgZm9yICg7IHQuaGVhcF9sZW4gPCAyOykgclsyICogKG4gPSB0LmhlYXBbKyt0LmhlYXBfbGVuXSA9IGggPCAyID8gKytoIDogMCldID0gMSwgdC5kZXB0aFtuXSA9IDAsIHQub3B0X2xlbi0tLCBvICYmICh0LnN0YXRpY19sZW4gLT0gc1syICogbiArIDFdKTtcXG4gICAgICAgICAgICAgICAgZm9yIChlLm1heF9jb2RlID0gaCwgYSA9IHQuaGVhcF9sZW4gPj4gMTsgMSA8PSBhOyBhLS0pIFkodCwgciwgYSk7XFxuICAgICAgICAgICAgICAgIGZvciAobiA9IGw7IGEgPSB0LmhlYXBbMV0sIHQuaGVhcFsxXSA9IHQuaGVhcFt0LmhlYXBfbGVuLS1dLCBZKHQsIHIsIDEpLCBpID0gdC5oZWFwWzFdLCB0LmhlYXBbLS10LmhlYXBfbWF4XSA9IGEsIHQuaGVhcFstLXQuaGVhcF9tYXhdID0gaSwgclsyICogbl0gPSByWzIgKiBhXSArIHJbMiAqIGldLCB0LmRlcHRoW25dID0gKHQuZGVwdGhbYV0gPj0gdC5kZXB0aFtpXSA/IHQuZGVwdGhbYV0gOiB0LmRlcHRoW2ldKSArIDEsIHJbMiAqIGEgKyAxXSA9IHJbMiAqIGkgKyAxXSA9IG4sIHQuaGVhcFsxXSA9IG4rKywgWSh0LCByLCAxKSwgMiA8PSB0LmhlYXBfbGVuOyk7XFxuICAgICAgICAgICAgICAgIHQuaGVhcFstLXQuaGVhcF9tYXhdID0gdC5oZWFwWzFdLFxcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24odCwgZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCBpLCBuLCByLCBzLCBvLCBsID0gZS5keW5fdHJlZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IGUubWF4X2NvZGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBlLnN0YXRfZGVzYy5zdGF0aWNfdHJlZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGUuc3RhdF9kZXNjLmhhc19zdHJlZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXyA9IGUuc3RhdF9kZXNjLmV4dHJhX2JpdHMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBlLnN0YXRfZGVzYy5leHRyYV9iYXNlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gZS5zdGF0X2Rlc2MubWF4X2xlbmd0aCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IDA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyID0gMDsgciA8PSBtOyByKyspIHQuYmxfY291bnRbcl0gPSAwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobFsyICogdC5oZWFwW3QuaGVhcF9tYXhdICsgMV0gPSAwLCBhID0gdC5oZWFwX21heCArIDE7IGEgPCBnOyBhKyspIGMgPCAociA9IGxbMiAqIGxbMiAqIChpID0gdC5oZWFwW2FdKSArIDFdICsgMV0gKyAxKSAmJiAociA9IGMsIGIrKyksIGxbMiAqIGkgKyAxXSA9IHIsIGggPCBpIHx8ICh0LmJsX2NvdW50W3JdKyssIHMgPSAwLCB1IDw9IGkgJiYgKHMgPSBfW2kgLSB1XSksIG8gPSBsWzIgKiBpXSwgdC5vcHRfbGVuICs9IG8gKiAociArIHMpLCBmICYmICh0LnN0YXRpY19sZW4gKz0gbyAqIChkWzIgKiBpICsgMV0gKyBzKSkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwICE9PSBiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociA9IGMgLSAxOyAwID09PSB0LmJsX2NvdW50W3JdOykgci0tO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ibF9jb3VudFtyXS0tLCB0LmJsX2NvdW50W3IgKyAxXSArPSAyLCB0LmJsX2NvdW50W2NdLS0sIGIgLT0gMlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgwIDwgYik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociA9IGM7IDAgIT09IHI7IHItLSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IHQuYmxfY291bnRbcl07IDAgIT09IGk7KSBoIDwgKG4gPSB0LmhlYXBbLS1hXSkgfHwgKGxbMiAqIG4gKyAxXSAhPT0gciAmJiAodC5vcHRfbGVuICs9IChyIC0gbFsyICogbiArIDFdKSAqIGxbMiAqIG5dLCBsWzIgKiBuICsgMV0gPSByKSwgaS0tKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0odCwgZSksIGoociwgaCwgdC5ibF9jb3VudClcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gWCh0LCBlLCBhKSB7XFxuICAgICAgICAgICAgICAgIHZhciBpLCBuLCByID0gLTEsXFxuICAgICAgICAgICAgICAgICAgICBzID0gZVsxXSxcXG4gICAgICAgICAgICAgICAgICAgIG8gPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgbCA9IDcsXFxuICAgICAgICAgICAgICAgICAgICBoID0gNDtcXG4gICAgICAgICAgICAgICAgZm9yICgwID09PSBzICYmIChsID0gMTM4LCBoID0gMyksIGVbMiAqIChhICsgMSkgKyAxXSA9IDY1NTM1LCBpID0gMDsgaSA8PSBhOyBpKyspIG4gPSBzLCBzID0gZVsyICogKGkgKyAxKSArIDFdLCArK28gPCBsICYmIG4gPT09IHMgfHwgKG8gPCBoID8gdC5ibF90cmVlWzIgKiBuXSArPSBvIDogMCAhPT0gbiA/IChuICE9PSByICYmIHQuYmxfdHJlZVsyICogbl0rKywgdC5ibF90cmVlWzIgKiBwXSsrKSA6IG8gPD0gMTAgPyB0LmJsX3RyZWVbMiAqIHZdKysgOiB0LmJsX3RyZWVbMiAqIGtdKyssIHIgPSBuLCAobyA9IDApID09PSBzID8gKGwgPSAxMzgsIGggPSAzKSA6IG4gPT09IHMgPyAobCA9IDYsIGggPSAzKSA6IChsID0gNywgaCA9IDQpKVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBXKHQsIGUsIGEpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGksIG4sIHIgPSAtMSxcXG4gICAgICAgICAgICAgICAgICAgIHMgPSBlWzFdLFxcbiAgICAgICAgICAgICAgICAgICAgbyA9IDAsXFxuICAgICAgICAgICAgICAgICAgICBsID0gNyxcXG4gICAgICAgICAgICAgICAgICAgIGggPSA0O1xcbiAgICAgICAgICAgICAgICBmb3IgKDAgPT09IHMgJiYgKGwgPSAxMzgsIGggPSAzKSwgaSA9IDA7IGkgPD0gYTsgaSsrKVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSBzLCBzID0gZVsyICogKGkgKyAxKSArIDFdLCAhKCsrbyA8IGwgJiYgbiA9PT0gcykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobyA8IGgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBMKHQsIG4sIHQuYmxfdHJlZSksIDAgIT0gLS1vOyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSAwICE9PSBuID8gKG4gIT09IHIgJiYgKEwodCwgbiwgdC5ibF90cmVlKSwgby0tKSwgTCh0LCBwLCB0LmJsX3RyZWUpLCBGKHQsIG8gLSAzLCAyKSkgOiBvIDw9IDEwID8gKEwodCwgdiwgdC5ibF90cmVlKSwgRih0LCBvIC0gMywgMykpIDogKEwodCwgaywgdC5ibF90cmVlKSwgRih0LCBvIC0gMTEsIDcpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByID0gbiwgKG8gPSAwKSA9PT0gcyA/IChsID0gMTM4LCBoID0gMykgOiBuID09PSBzID8gKGwgPSA2LCBoID0gMykgOiAobCA9IDcsIGggPSA0KVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpKEQpO1xcbiAgICAgICAgICAgIHZhciBKID0gITE7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gUSh0LCBlLCBhLCBpKSB7XFxuICAgICAgICAgICAgICAgIHZhciBuLCByLCBzLCBvO1xcbiAgICAgICAgICAgICAgICBGKHQsIChkIDw8IDEpICsgKGkgPyAxIDogMCksIDMpLCByID0gZSwgcyA9IGEsIG8gPSAhMCwgTShuID0gdCksIG8gJiYgKFQobiwgcyksIFQobiwgfnMpKSwgbC5hcnJheVNldChuLnBlbmRpbmdfYnVmLCBuLndpbmRvdywgciwgcywgbi5wZW5kaW5nKSwgbi5wZW5kaW5nICs9IHNcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYS5fdHJfaW5pdCA9IGZ1bmN0aW9uKHQpIHtcXG4gICAgICAgICAgICAgICAgSiB8fCAoZnVuY3Rpb24oKSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgdCwgZSwgYSwgaSwgbiwgciA9IG5ldyBBcnJheShtICsgMSk7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSBhID0gMDsgaSA8IHMgLSAxOyBpKyspXFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChSW2ldID0gYSwgdCA9IDA7IHQgPCAxIDw8IHlbaV07IHQrKykgWlthKytdID0gaTtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoWlthIC0gMV0gPSBpLCBpID0gbiA9IDA7IGkgPCAxNjsgaSsrKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoRFtpXSA9IG4sIHQgPSAwOyB0IDwgMSA8PCB4W2ldOyB0KyspIEFbbisrXSA9IGk7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPj49IDc7IGkgPCB1OyBpKyspXFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChEW2ldID0gbiA8PCA3LCB0ID0gMDsgdCA8IDEgPDwgeFtpXSAtIDc7IHQrKykgQVsyNTYgKyBuKytdID0gaTtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IDA7IGUgPD0gbTsgZSsrKSByW2VdID0gMDtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAodCA9IDA7IHQgPD0gMTQzOykgU1syICogdCArIDFdID0gOCwgdCsrLCByWzhdKys7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKDsgdCA8PSAyNTU7KSBTWzIgKiB0ICsgMV0gPSA5LCB0KyssIHJbOV0rKztcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoOyB0IDw9IDI3OTspIFNbMiAqIHQgKyAxXSA9IDcsIHQrKywgcls3XSsrO1xcbiAgICAgICAgICAgICAgICAgICAgZm9yICg7IHQgPD0gMjg3OykgU1syICogdCArIDFdID0gOCwgdCsrLCByWzhdKys7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGooUywgXyArIDEsIHIpLCB0ID0gMDsgdCA8IHU7IHQrKykgRVsyICogdCArIDFdID0gNSwgRVsyICogdF0gPSBIKHQsIDUpO1xcbiAgICAgICAgICAgICAgICAgICAgQyA9IG5ldyBJKFMsIHksIGYgKyAxLCBfLCBtKSwgTiA9IG5ldyBJKEUsIHgsIDAsIHUsIG0pLCBPID0gbmV3IEkobmV3IEFycmF5KDApLCB6LCAwLCBjLCBiKVxcbiAgICAgICAgICAgICAgICB9KCksIEogPSAhMCksIHQubF9kZXNjID0gbmV3IHIodC5keW5fbHRyZWUsIEMpLCB0LmRfZGVzYyA9IG5ldyByKHQuZHluX2R0cmVlLCBOKSwgdC5ibF9kZXNjID0gbmV3IHIodC5ibF90cmVlLCBPKSwgdC5iaV9idWYgPSAwLCB0LmJpX3ZhbGlkID0gMCwgSyh0KVxcbiAgICAgICAgICAgIH0sIGEuX3RyX3N0b3JlZF9ibG9jayA9IFEsIGEuX3RyX2ZsdXNoX2Jsb2NrID0gZnVuY3Rpb24odCwgZSwgYSwgaSkge1xcbiAgICAgICAgICAgICAgICB2YXIgbiwgciwgcyA9IDA7XFxuICAgICAgICAgICAgICAgIDAgPCB0LmxldmVsID8gKDIgPT09IHQuc3RybS5kYXRhX3R5cGUgJiYgKHQuc3RybS5kYXRhX3R5cGUgPSBmdW5jdGlvbih0KSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgZSwgYSA9IDQwOTM2MjQ0NDc7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSAwOyBlIDw9IDMxOyBlKyssIGEgPj4+PSAxKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxICYgYSAmJiAwICE9PSB0LmR5bl9sdHJlZVsyICogZV0pIHJldHVybiBvO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09IHQuZHluX2x0cmVlWzE4XSB8fCAwICE9PSB0LmR5bl9sdHJlZVsyMF0gfHwgMCAhPT0gdC5keW5fbHRyZWVbMjZdKSByZXR1cm4gaDtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IDMyOyBlIDwgZjsgZSsrKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwICE9PSB0LmR5bl9sdHJlZVsyICogZV0pIHJldHVybiBoO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9cXG4gICAgICAgICAgICAgICAgfSh0KSksIEcodCwgdC5sX2Rlc2MpLCBHKHQsIHQuZF9kZXNjKSwgcyA9IGZ1bmN0aW9uKHQpIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBlO1xcbiAgICAgICAgICAgICAgICAgICAgZm9yIChYKHQsIHQuZHluX2x0cmVlLCB0LmxfZGVzYy5tYXhfY29kZSksIFgodCwgdC5keW5fZHRyZWUsIHQuZF9kZXNjLm1heF9jb2RlKSwgRyh0LCB0LmJsX2Rlc2MpLCBlID0gYyAtIDE7IDMgPD0gZSAmJiAwID09PSB0LmJsX3RyZWVbMiAqIEJbZV0gKyAxXTsgZS0tKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lm9wdF9sZW4gKz0gMyAqIChlICsgMSkgKyA1ICsgNSArIDQsIGVcXG4gICAgICAgICAgICAgICAgfSh0KSwgbiA9IHQub3B0X2xlbiArIDMgKyA3ID4+PiAzLCAociA9IHQuc3RhdGljX2xlbiArIDMgK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m5hbWUpO1xcbiAgICAgICAgICAgIGlmIChoYXNSdWxlIHx8IG9iai5uYW1lID09ICcnKSB7XFxuICAgICAgICAgICAgICAgIC8vdG9hc3QoXFxcIuivt+mFjee9ruW/q+mAn+aQnOe0olxcXCIpXFxuICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9zZWFyY2g/cz0nICsgdGl0bGUgKyAnJnJ1bGU9JyArIG9iai5uYW1lO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuXFxuICAgICAgICAgICAgICAgIGlmIChvYmouaGFzT3duUHJvcGVydHkoXFxcInJ1bGVcXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKG9iai5ydWxlLmluZGV4T2YoJ2NvcHknKSE9LTEpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0b2FzdChcXFwi5bey57uP5aSN5Yi26K+35a+85YWl6KeE5YiZXFxcIilcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBvYmoucnVsZVxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+ivt+WuieijhVxcXCIgKyBvYmoubmFtZSArIFxcXCLlsI/nqIvluo9cXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwgb2JqLCBcXFwiaGlrZXI6Ly9ob21lXFxcIiwgdGl0bGUpLFxcbiAgICAgICAgcGljX3VybDogb2JqLnBpYyxcXG4gICAgICAgIGNvbF90eXBlOiBqc29uLnF1aWNrU2VhcmNoQ29uZmlncy5tb2RlLFxcbiAgICAgICAgZXh0cmE6e2lkOidxc2VhcmNoJ31cXG4gICAgfSlcXG59XFxuXFxuXFxuLyogICAgJCgpLmxhenlSdWxlKChvYmosIGhvbWUsIHRpdGxlKSA9PiB7XFxuICAgICAgICBsZXQgcnVsZUxpc3QgPSBKU09OL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