xiaomianao666

小程序:搜视

Oct 10th, 2023
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@搜视@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoi5pCc6KeGIiwiYXV0aG9yIjoiIiwidXJsIjoiaGlrZXI6Ly9lbXB0eSMjZnlwYWdlIiwidmVyc2lvbiI6OSwiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJhbGwiLCJjbGFzc191cmwiOiIiLCJhcmVhX25hbWUiOiIiLCJhcmVhX3VybCI6IiIsInNvcnRfbmFtZSI6IiIsInllYXJfbmFtZSI6IiIsInNvcnRfdXJsIjoiIiwieWVhcl91cmwiOiIiLCJmaW5kX3J1bGUiOiJqczogXG5cblxucmVxdWlyZShjb25maWcu5L6d6LWWKVxuXG4geWlqaSgpIiwic2VhcmNoX3VybCI6Imhpa2VyOi8vZW1wdHkjIyoqIyNmeXBhZ2UiLCJncm91cCI6IuKRoOW4uOeUqCIsInNlYXJjaEZpbmQiOiJqczpcbnJlcXVpcmUoY29uZmlnLuS+nei1lik7XG5zb3VzdW8oKSIsImRldGFpbF9jb2xfdHlwZSI6Im1vdmllXzMiLCJkZXRhaWxfZmluZF9ydWxlIjoianM6IFxuXG5cbnJlcXVpcmUoY29uZmlnLuS+nei1lilcbiAgZXJqaSgpIiwic2RldGFpbF9jb2xfdHlwZSI6Im1vdmllXzEiLCJzZGV0YWlsX2ZpbmRfcnVsZSI6IioiLCJ1YSI6InBjIiwicHJlUnVsZSI6IlxuXG52YXIgdWkgPSBnZXRQYXRoKCdoaWtlcjovL2ZpbGVzL3J1bGVzL3pldGFscGhhL2hrVWkuanMnKVxuICAgIGluaXRDb25maWcoe1xuICAgICAgICAvL+S+nei1ljogXCJodHRwczovL2dpdGNvZGUubmV0L2dmNDQ4ODAyNi9Iay8tL3Jhdy9KdS9Tc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L2VtcHR5JztcXG4gICAgICAgICAgICB9LHNuYW1lKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgfSk7XFxuICAgIGNhdGVnb3JpZXMuZm9yRWFjaCgoY2F0ZWdvcnksIGluZGV4KSA9PiB7XFxuICAgICAgICBsZXQgc3ViX2NhdGVnb3JpZXMgPSBwZGZhKGNhdGVnb3J5LCDlsI/nsbvlrprkvY0pO1xcbiAgICAgICAgaWYgKGluZGV4ID09PSAwKSB7XFxuICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMuZm9yRWFjaCgoaXRlbSwga2V5KSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCB0aXRsZSA9IHBkZmgoaXRlbSwg5YiG57G75qCH6aKYKVxcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mKOaOkumZpCkgIT0gJ3VuZGVmaW5lZCcgJiYg5o6S6ZmkICE9ICcnKSB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZToga2V5LnRvU3RyaW5nKCkgPT09IGNhdGVfdGVtcFtpbmRleF0gPyBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIHRpdGxlLmZvbnRjb2xvcijliIbnsbvpopzoibIpIDogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6ICQocGQoaXRlbSwg5YiG57G76ZO+5o6lKSArICcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgbmV3X2NhdGUgPSBbXVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXAuZm9yRWFjaCgoY2F0ZSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3X2NhdGUucHVzaChpbmRleCA9PT0gMCA/IHBhcmFtcy5rZXkudG9TdHJpbmcoKSA6IFxcXCIwXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgc25hbWU9cGFyYW1zLnNuYW1lO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHNuYW1lK1xcXCJfdGl0bGVcXFwiLCBKU09OLnN0cmluZ2lmeShuZXdfY2F0ZSkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHNuYW1lK1xcXCJfdXJsXFxcIiwgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UodHJ1ZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxuICAgICAgICAgICAgICAgICAgICAgICAga2V5OiBrZXksXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzbmFtZTpzbmFtZVxcbiAgICAgICAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCJcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSBpZiAoZm9sZCA9PT0gJzEnKSB7XFxuICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMuZm9yRWFjaCgoaXRlbSwga2V5KSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCB0aXRsZSA9IHBkZmgoaXRlbSwg5YiG57G75qCH6aKYKVxcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mKOaOkumZpCkgIT0gJ3VuZGVmaW5lZCcgJiYg5o6S6ZmkICE9ICcnKSB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZToga2V5LnRvU3RyaW5nKCkgPT09IGNhdGVfdGVtcFtpbmRleF0gPyBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIHRpdGxlLmZvbnRjb2xvcijliIbnsbvpopzoibIpIDogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6ICQocGQoaXRlbSwg5YiG57G76ZO+5o6lKSArICcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXG5wYXJhbXMuY2F0ZV90ZW1wW3BhcmFtcy5pbmRleF0gPSBwYXJhbXMua2V5LnRvU3RyaW5nKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHNuYW1lPXBhcmFtcy5zbmFtZTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzbmFtZStcXFwiX3RpdGxlXFxcIiwgSlNPTi5zdHJpbmdpZnkocGFyYW1zLmNhdGVfdGVtcCkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHNuYW1lK1xcXCJfdXJsXFxcIiwgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UodHJ1ZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IGluZGV4LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGtleToga2V5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2U6IHBhZ2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgc25hbWU6c25hbWVcXG4gICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYmxhbmtfYmxvY2tcXFwiXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgIH0pXFxufVxcblxcblwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi5pu05pawXCIsXCJwYXRoXCI6XCJ1cGRhdGFcIixcInJ1bGVcIjpcIlxcblxcbnZhciBkID0gW107XFxucHV0VmFyKFxcXCJqbFxcXCIsIDApO1xcblxcbmZ1bmN0aW9uIHBpbihhLCBiKSB7XFxuICAgIHJldHVybiAoYiA9PSAwID8gJ+KAnOKAnOKAneKAnScgOiAnJykgKyAnPGZvbnQgY29sb3I9XFxcIiNlZjViOWNcXFwiPicgKyBhICsgJzwvZm9udD4nO1xcbn1cXG5cXG5hID0gZ2V0VmFyKCdheGUnLCAnNicpO1xcbmQucHVzaCh7XFxuICAgIHRpdGxlOiAoYSA9PSA1ID8gJ+KAnOKAnOKAneKAnTxmb250IGNvbG9yPVxcXCJyZWRcXFwiPu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ICAgICAgfSxcXG4gICAgICAgIG1ldGhvZDogJ1BPU1QnLFxcbiAgICAgICAgYm9keTogYm9keVxcbiAgICB9KSkuZGF0YS5jYXJkLmNoaWxkcmVuX2xpc3QubGlzdC5jYXJkcy5zbGljZSg3KS5maWx0ZXIoYSA9PiB7XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIGlmIChhLnBhcmFtcy5wYXlfZXBpc29kZSAmJiBhLnBhcmFtcy5wYXlfdGltZSkge1xcbiAgICAgICAgICAgICAgICBhLnB1Yl90aW1lID0gYS5wYXJhbXMucGF5X3RpbWU7XFxuICAgICAgICAgICAgICAgIGEuc3F1YXJlX2NvdmVyID0gYS5wYXJhbXMuaW1hZ2VfdXJsO1xcbiAgICAgICAgICAgICAgICBhLnB1Yl9pbmRleCA9IGEucGFyYW1zLnBheV9lcGlzb2RlO1xcbiAgICAgICAgICAgICAgICBhLnRpdGxlID0gYS5wYXJhbXMudGl0bGU7XFxuICAgICAgICAgICAgICAgIGEudXJsID0gJ2h0dHBzOi8vdi5xcS5jb20veC9jb3Zlci8nICsgYS5wYXJhbXMuY2lkICsgJy5odG1sJ1xcbiAgICAgICAgICAgICAgICByZXR1cm4gYTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuXFxuXFxufSBjYXRjaCAoZSkge1xcbiAgICB5bTMgPSBbXTtcXG59XFxuXFxuXFxuXFxueW0gPSB5bS5jb25jYXQoeW0zKTtcXG5cXG55bSA9IHltLnNvcnQoZnVuY3Rpb24gdihhLCBiKSB7XFxuXFxuICAgIHZhciBhYSA9IGEucHViX3RpbWU7XFxuXFxuICAgIHZhciBjID0gcGFyc2VJbnQoYWEuc3BsaXQoJzonKVswXSwgMTApICogNjAgKyBwYXJzZUludChhYS5zcGxpdCgnOicpWzFdLCAxMCk7XFxuICAgIHZhciBiYiA9IGIucHViX3RpbWU7XFxuICAgIHZhciBkID0gcGFyc2VJbnQoYmIuc3BsaXQoJzonKVswXSwgMTApICogNjAgKyBwYXJzZUludChiYi5zcGxpdCgnOicpWzFdLCAxMCk7XFxuXFxuICAgIHJldHVybiBjIC0gZDtcXG59KTtcXG5cXG4vL2QucHVzaCh7dGl0bGU6eW19KTtcXG4vL+WQiOW5tuaOkuW6j+e7k+adn1xcblxcblxcblxcbmggPSBoIDwgMTAgPyAoJzAnICsgaCkgOiBoO1xcbm0gPSBtIDwgMTAgPyAoJzAnICsgbSkgOiBtO1xcblxcbmZvciAodmFywqAgacKgIGluIMKgeW0pIHtcXG5cXG4gICAgdmFyIHRpID0geW1baV0ucHViX3RpbWU7XFxuXFxuICAgIGlmIChhID09IDYpIHtcXG4gICAgICAgIHZhciBzaWkgPSBwYXJzZUludCh0aS5zcGxpdCgnOicpWzBdLCAxMCkgKiA2MCArIHBhcnNlSW50KHRpLnNwbGl0KCc6JylbMV0sIDEwKTtcXG5cXG5cXG4gICAgICAgIGlmIChzaSA8IHNpaSAmJiBjcyA9PSAwKSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICflvZPliY3ml7bpl7TvvJrigJzigJwnICsgaCArICc6JyArIG0gKyAn4oCd4oCdJyxcXG4gICAgICAgICAgICAgICAgdXJsOiBgaGlrZXI6Ly9lbXB0eUBsYXp5UnVsZT0uanM6cmVmcmVzaFBhZ2UoZmFsc2UpOyd0b2FzdDovL+WIt+aWsOWujOavle+8gSdgLFxcbiAgICAgICAgICAgICAgICBkZXNjOiAn54K55Ye75Yi35pawJyxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJ1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGNzKys7XFxuICAgICAgICAgICAgc3QgPSAnJztcXG4gICAgICAgIH1cXG4gICAgfVxcblxcbiAgICB2YXIgbm4gPSBzdCA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VcXFwiPicgKyAoaW5kKSArICc8L2ZvbnQ+JykgOiAoJzxmb250IGNvbG9yPVxcXCJncmV5XFxcIj4nICsgJ+acrOWRqOWBnOabtCAnICsgeW1baV0uZGVsYXlfaW5kZXggKyAnPC9mb250PicpKSxcXG4gICAgICAgIGRlc2M6ICFkciA/IGRlIDogKCc8ZGVsPicgKyBkZSArICc8L2RlbD4nKSxcXG4gICAgICAgIHBpY191cmw6IHltW2ldLnNxdWFyZV9jb3ZlciArICh1LmluY2x1ZGVzKCdiaWxpYmlsaScpID8gJ0BSZWZlcmVyPWh0dHBzOi8vd3d3LmJpbGliaWxpLmNvbScgOiAnJyksXFxuICAgICAgICB1cmw6IHUsXFxuICAgICAgICBjb2xfdHlwZTogJ21vdmllXzEnLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBzbmFtZTogdS5pbmNsdWRlcygnYmlsaWJpbGknKSA/IFxcXCLlk5Tlk6nlk5Tlk6lcXFwiIDogXFxcIuiFvuiur+inhumikVxcXCIsXFxuICAgICAgICAgICAgbmFtZTogemYsXFxuICAgICAgICAgICAgcGFnZVRpdGxlOiB6ZixcXG4gICAgICAgICAgICBzdHlwZTogXFxcIuato+eJiFxcXCJcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgXFxuICAgIGlmIChhID09IDYgJiYgc2kgPj0gc2lpICYmIGkgPT0geW0ubGVuZ3RoIC0gMSkge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+W9k+WJjeaXtumXtO+8muKAnOKAnCcgKyBoICsgJzonICsgbSArICfigJ3igJ0nLFxcbiAgICAgICAgICAgIHVybDogYGhpa2VyOi8vZW1wdHlAbGF6eVJ1bGU9LmpzOnJlZnJlc2hQYWdlKGZhbHNlKTsndG9hc3Q6Ly/liLfmlrDlrozmr5XvvIEnYCxcXG4gICAgICAgICAgICBkZXNjOiAn5LuK5pel55Wq5Ymn5bey5YWo6YOo5pu05paw77yM5oSf6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xldCBkbUxpc3QgPSBkYW5tdS5nZXREYW5NdShlbmNvZGVVUklDb21wb25lbnQobmFtZSkpO1xcblxcbiAgICAgICAgdmFyIGFuaW1lID0gZG1MaXN0LmFuaW1lcztcXG4gICAgICAgIGlmIChhbmltZS5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgdmFyIGVwaXNvZGUgPSBhbmltZVswXS5lcGlzb2Rlc1xcbiAgICAgICAgICAgIGlmIChlcGlzb2RlLmxlbmd0aCAtIDEgPj0gaSkge1xcbiAgICAgICAgICAgICAgICB2YXIgZXBpc29kZUlkID0gZXBpc29kZVtpXS5lcGlzb2RlSWQ7XFxuICAgICAgICAgICAgICAgIHZhciBlcGlzb2RlVGl0bGUgPSBlcGlzb2RlW2ldLmVwaXNvZGVUaXRsZTtcXG5cXG4gICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwYXRoID0gZGFubXUuZ2V0TG9jYWxEYW5NdShlcGlzb2RlSWQsIG5hbWUgKyBcXFwiX1xcXCIgKyB0aXRsZSkgfHwgZGFubXUuZG93bmxvYWREYW5NdShlcGlzb2RlSWQsIG5hbWUgKyBcXFwiX1xcXCIgKyB0aXRsZSk7XFxuXFxuICAgICAgICAgICAgICAgICAgICBpZiAocGF0aCA9PSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0b2FzdChcXFwi5pqC5peg5by55bmVXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcIlxcXCJcXG5cXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoXFxcIuW8ueW5leWKoOi9veaIkOWKn1xcXCIpXFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhdGhcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAg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xcbiAgICAgICAgaWYgKHBhcmFtVGV4dCA9PSBudWxsIHx8IGNvbW1lbnRUZXh0ID09IG51bGwpIGNvbnRpbnVlO1xcbiAgICAgICAgbGV0IHBhcmFtcyA9IHBhcmFtVGV4dC5zcGxpdChcXFwiLFxcXCIpO1xcbiAgICAgICAgbGV0IHBhcmFtc1QgPSBbXTtcXG4gICAgICAgIGZvciAobGV0IGkgaW4gcGFyYW1zKSB7XFxuICAgICAgICAgICAgaWYgKGkgPT0gMykge1xcbiAgICAgICAgICAgICAgICAvL+minOiJsuWAvOS4ujDml7bvvIzpu5jorqTorr7nva7kuLrnmb3oibJcXG4gICAgICAgICAgICAgICAgaWYgKHBhcmFtc1tpXSA9PSBcXFwiMFxcXCIgfHwgcGFyYW1zW2ldID09IFxcXCItMVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtc1QucHVzaChcXFwiMTY3NzcyMTVcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlXFxuICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgaWYgKGkgPT0gMikge1xcbiAgICAgICAgICAgICAgICBkbVNldHRpbmdzID0gSlNPTi5wYXJzZShyZXF1ZXN0KCdoaWtlcjovL2ZpbGVzL2Rt55uS5a2QL3NldHRpbmdzLmpzb24nKSk7XFxuICAgICAgICAgICAgICAgIGZvbnRTaXplID0gZG1TZXR0aW5ncy5mb250U2l6ZTtcXG4gICAgICAgICAgICAgICAgcGFyYW1zVC5wdXNoKGZvbnRTaXplKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcGFyYW1zVC5wdXNoKHBhcmFtc1tpXSk7XFxuXFxuICAgICAgICB9XFxuICAgICAgICBwYXJhbXNULnB1c2goXFxcIjBcXFwiLCBcXFwiMFxcXCIsIFxcXCIwXFxcIik7XFxuICAgICAgICBkTWNvbnRleHQgKz0gYDxkIHA9XFxcIiR7cGFyYW1zVC5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InVuZGVmaW5lZFxcXCIgIT0gdHlwZW9mIGdsb2JhbCA/IGdsb2JhbCA6IFxcXCJ1bmRlZmluZWRcXFwiICE9IHR5cGVvZiBzZWxmID8gc2VsZiA6IHRoaXMpLnBha28gPSB0KClcXG4gICAgfVxcbn0oZnVuY3Rpb24oKSB7XFxuICAgIHJldHVybiBmdW5jdGlvbiByKHMsIG8sIGwpIHtcXG4gICAgICAgIGZ1bmN0aW9uIGgoZSwgdCkge1xcbiAgICAgICAgICAgIGlmICghb1tlXSkge1xcbiAgICAgICAgICAgICAgICBpZiAoIXNbZV0pIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBhID0gXFxcImZ1bmN0aW9uXFxcIiA9PSB0eXBlb2YgcmVxdWlyZSAmJiByZXF1aXJlO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF0ICYmIGEpIHJldHVybiBhKGUsICEwKTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChkKSByZXR1cm4gZChlLCAhMCk7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG5ldyBFcnJvcihcXFwiQ2Fubm90IGZpbmQgbW9kdWxlICdcXFwiICsgZSArIFxcXCInXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBpLmNvZGUgPSBcXFwiTU9EVUxFX05PVF9GT1VORFxcXCIsIGlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB2YXIgbiA9IG9bZV0gPSB7XFxuICAgICAgICAgICAgICAgICAgICBleHBvcnRzOiB7fVxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICBzW2VdWzBdLmNhbGwobi5leHBvcnRzLCBmdW5jdGlvbih0KSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaChzW2VdWzFdW3RdIHx8IHQpXFxuICAgICAgICAgICAgICAgIH0sIG4sIG4uZXhwb3J0cywgciwgcywgbywgbClcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIG9bZV0uZXhwb3J0c1xcbiAgICAgICAgfVxcbiAgICAgICAgZm9yICh2YXIgZCA9IFxcXCJmdW5jdGlvblxcXCIgPT0gdHlwZW9mIHJlcXVpcmUgJiYgcmVxdWlyZSwgdCA9IDA7IHQgPCBsLmxlbmd0aDsgdCsrKSBoKGxbdF0pO1xcbiAgICAgICAgcmV0dXJuIGhcXG4gICAgfSh7XFxuICAgICAgICAxOiBbZnVuY3Rpb24odCwgZSwgYSkge1xcbiAgICAgICAgICAgIFxcXCJ1c2Ugc3RyaWN0XFxcIjtcXG4gICAgICAgICAgICB2YXIgcyA9IHQoXFxcIi4vemxpYi9kZWZsYXRlXFxcIiksXFxuICAgICAgICAgICAgICAgIG8gPSB0KFxcXCIuL3V0aWxzL2NvbW1vblxcXCIpLFxcbiAgICAgICAgICAgICAgICBsID0gdChcXFwiLi91dGlscy9zdHJpbmdzXFxcIiksXFxuICAgICAgICAgICAgICAgIG4gPSB0KFxcXCIuL3psaWIvbWVzc2FnZXNcXFwiKSxcXG4gICAgICAgICAgICAgICAgciA9IHQoXFxcIi4vemxpYi96c3RyZWFtXFxcIiksXFxuICAgICAgICAgICAgICAgIGggPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLFxcbiAgICAgICAgICAgICAgICBkID0gMCxcXG4gICAgICAgICAgICAgICAgZiA9IC0xLFxcbiAgICAgICAgICAgICAgICBfID0gMCxcXG4gICAgICAgICAgICAgICAgdSA9IDg7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gYyh0KSB7XFxuICAgICAgICAgICAgICAgIGlmICghKHRoaXMgaW5zdGFuY2VvZiBjKSkgcmV0dXJuIG5ldyBjKHQpO1xcbiAgICAgICAgICAgICAgICB0aGlzLm9wdGlvbnMgPSBvLmFzc2lnbih7XFxuICAgICAgICAgICAgICAgICAgICBsZXZlbDogZixcXG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogdSxcXG4gICAgICAgICAgICAgICAgICAgIGNodW5rU2l6ZTogMTYzODQsXFxuICAgICAgICAgICAgICAgICAgICB3aW5kb3dCaXRzOiAxNSxcXG4gICAgICAgICAgICAgICAgICAgIG1lbUxldmVsOiA4LFxcbiAgICAgICAgICAgICAgICAgICAgc3RyYXRlZ3k6IF8sXFxuICAgICAgICAgICAgICAgICAgICB0bzogXFxcIlxcXCJcXG4gICAgICAgICAgICAgICAgfSwgdCB8fCB7fSk7XFxuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5vcHRpb25zO1xcbiAgICAgICAgICAgICAgICBlLnJhdyAmJiAwIDwgZS53aW5kb3dCaXRzID8gZS53aW5kb3dCaXRzID0gLWUud2luZG93Qml0cyA6IGUuZ3ppcCAmJiAwIDwgZS53aW5kb3dCaXRzICYmIGUud2luZG93Qml0cyA8IDE2ICYmIChlLndpbmRvd0JpdHMgKz0gMTYpLCB0aGlzLmVyciA9IDAsIHRoaXMubXNnID0gXFxcIlxcXCIsIHRoaXMuZW5kZWQgPSAhMSwgdGhpcy5jaHVua3MgPSBbXSwgdGhpcy5zdHJtID0gbmV3IHIsIHRoaXMuc3RybS5hdmFpbF9vdXQgPSAwO1xcbiAgICAgICAgICAgICAgICB2YXIgYSA9IHMuZGVmbGF0ZUluaXQyKHRoaXMuc3RybSwgZS5sZXZlbCwgZS5tZXRob2QsIGUud2luZG93Qml0cywgZS5tZW1MZXZlbCwgZS5zdHJhdGVneSk7XFxuICAgICAgICAgICAgICAgIGlmIChhICE9PSBkKSB0aHJvdyBuZXcgRXJyb3IoblthXSk7XFxuICAgICAgICAgICAgICAgIGlmIChlLmhlYWRlciAmJiBzLmRlZmxhdGVTZXRIZWFkZXIodGhpcy5zdHJtLCBlLmhlYWRlciksIGUuZGljdGlvbmFyeSkge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoaSA9IFxcXCJzdHJpbmdcXFwiID09IHR5cGVvZiBlLmRpY3Rpb25hcnkgPyBsLnN0cmluZzJidWYoZS5kaWN0aW9uYXJ5KSA6IFxcXCJbb2JqZWN0IEFycmF5QnVmZmVyXVxcXCIgPT09IGguY2FsbChlLmRpY3Rpb25hcnkpID8gbmV3IFVpbnQ4QXJyYXkoZS5kaWN0aW9uYXJ5KSA6IGUuZGljdGlvbmFyeSwgKGEgPSBzLmRlZmxhdGVTZXREaWN0aW9uYXJ5KHRoaXMuc3RybSwgaSkpICE9PSBkKSB0aHJvdyBuZXcgRXJyb3IoblthXSk7XFxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9kaWN0X3NldCA9ICEwXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gaSh0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IGMoZSk7XFxuICAgICAgICAgICAgICAgIGlmIChhLnB1c2godCwgITApLCBhLmVycikgdGhyb3cgYS5tc2cgfHwgblthLmVycl07XFxuICAgICAgICAgICAgICAgIHJldHVybiBhLnJlc3VsdFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBjLnByb3RvdHlwZS5wdXNoID0gZnVuY3Rpb24odCwgZSkge1xcbiAgICAgICAgICAgICAgICB2YXIgYSwgaSwgbiA9IHRoaXMuc3RybSxcXG4gICAgICAgICAgICAgICAgICAgIHIgPSB0aGlzLm9wdGlvbnMuY2h1bmtTaXplO1xcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5lbmRlZCkgcmV0dXJuICExO1xcbiAgICAgICAgICAgICAgICBpID0gZSA9PT0gfn5lID8gZSA6ICEwID09PSBlID8gNCA6IDAsIFxcXCJzdHJpbmdcXFwiID09IHR5cGVvZiB0ID8gbi5pbnB1dCA9IGwuc3RyaW5nMmJ1Zih0KSA6IFxcXCJbb2JqZWN0IEFycmF5QnVmZmVyXVxcXCIgPT09IGguY2FsbCh0KSA/IG4uaW5wdXQgPSBuZXcgVWludDhBcnJheSh0KSA6IG4uaW5wdXQg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IuL3psaWIvaW5mbGF0ZVxcXCIpLFxcbiAgICAgICAgICAgICAgICBfID0gdChcXFwiLi91dGlscy9jb21tb25cXFwiKSxcXG4gICAgICAgICAgICAgICAgdSA9IHQoXFxcIi4vdXRpbHMvc3RyaW5nc1xcXCIpLFxcbiAgICAgICAgICAgICAgICBjID0gdChcXFwiLi96bGliL2NvbnN0YW50c1xcXCIpLFxcbiAgICAgICAgICAgICAgICBpID0gdChcXFwiLi96bGliL21lc3NhZ2VzXFxcIiksXFxuICAgICAgICAgICAgICAgIG4gPSB0KFxcXCIuL3psaWIvenN0cmVhbVxcXCIpLFxcbiAgICAgICAgICAgICAgICByID0gdChcXFwiLi96bGliL2d6aGVhZGVyXFxcIiksXFxuICAgICAgICAgICAgICAgIGIgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nO1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIHModCkge1xcbiAgICAgICAgICAgICAgICBpZiAoISh0aGlzIGluc3RhbmNlb2YgcykpIHJldHVybiBuZXcgcyh0KTtcXG4gICAgICAgICAgICAgICAgdGhpcy5vcHRpb25zID0gXy5hc3NpZ24oe1xcbiAgICAgICAgICAgICAgICAgICAgY2h1bmtTaXplOiAxNjM4NCxcXG4gICAgICAgICAgICAgICAgICAgIHdpbmRvd0JpdHM6IDAsXFxuICAgICAgICAgICAgICAgICAgICB0bzogXFxcIlxcXCJcXG4gICAgICAgICAgICAgICAgfSwgdCB8fCB7fSk7XFxuICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5vcHRpb25zO1xcbiAgICAgICAgICAgICAgICBlLnJhdyAmJiAwIDw9IGUud2luZG93Qml0cyAmJiBlLndpbmRvd0JpdHMgPCAxNiAmJiAoZS53aW5kb3dCaXRzID0gLWUud2luZG93Qml0cywgMCA9PT0gZS53aW5kb3dCaXRzICYmIChlLndpbmRvd0JpdHMgPSAtMTUpKSwgISgwIDw9IGUud2luZG93Qml0cyAmJiBlLndpbmRvd0JpdHMgPCAxN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0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IHMoZSk7XFxuICAgICAgICAgICAgICAgIGlmIChhLnB1c2godCwgITApLCBhLmVycikgdGhyb3cgYS5tc2cgfHwgaVthLmVycl07XFxuICAgICAgICAgICAgICAgIHJldHVybiBhLnJlc3VsdFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBzLnByb3RvdHlwZS5wdXNoID0gZnVuY3Rpb24odCwgZSkge1xcbiAgICAgICAgICAgICAgICB2YXIgYSwgaSwgbiwgciwgcywgbyA9IHRoaXMuc3RybSxcXG4gICAgICAgICAgICAgICAgICAgIGwgPSB0aGlzLm9wdGlvbnMuY2h1bmtTaXplLFxcbiAgICAgICAgICAgICAgICAgICAgaCA9IHRoaXMub3B0aW9ucy5kaWN0aW9uYXJ5LFxcbiAgICAgICAgICAgICAgICAgICAgZCA9ICExO1xcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5lbmRlZCkgcmV0dXJuICExO1xcbiAgICAgICAgICAgICAgICBpID0gZSA9PT0gfn5lID8gZSA6ICEwID09PSBlID8gYy5aX0ZJTklTSCA6IGMuWl9OT19GTFVTSCwgXFxcInN0cmluZ1xcXCIgPT0gdHlwZW9mIHQgPyBvLmlucHV0ID0gdS5iaW5zdHJpbmcyYnVmKHQpIDogXFxcIltvYmplY3QgQXJyYXlCdWZmZXJdXFxcIiA9PT0gYi5jYWxsKHQpID8gby5pbnB1dCA9IG5ldyBVaW50OEFycmF5KHQpIDogby5pbnB1dCA9IHQsIG8ubmV4dF9pbiA9IDAsIG8uYXZhaWxfaW4gPSBvLmlucHV0Lmxlbmd0aDtcXG4gICAgICAgICAgICAgICAgZG8ge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8uYXZhaWxfb3V0ICYmIChvLm91dHB1dCA9IG5ldyBfLkJ1ZjgobCksIG8ubmV4dF9vdXQgPSAwLCBvLmF2YWlsX291dCA9IGwpLCAoYSA9IGYuaW5mbGF0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ICAgXFxcIi4vemxpYi9jb25zdGFudHNcXFwiOiA2LFxcbiAgICAgICAgICAgIFxcXCIuL3psaWIvZ3poZWFkZXJcXFwiOiA5LFxcbiAgICAgICAgICAgIFxcXCIuL3psaWIvaW5mbGF0ZVxcXCI6IDExLFxcbiAgICAgICAgICAgIFxcXCIuL3psaWIvbWVzc2FnZXNcXFwiOiAxMyxcXG4gICAgICAgICAgICBcXFwiLi96bGliL3pzdHJlYW1cXFwiOiAxNVxcbiAgICAgICAgfV0sXFxuICAgICAgICAzOiBbZnVuY3Rpb24odCwgZSwgYSkge1xcbiAgICAgICAgICAgIFxcXCJ1c2Ugc3RyaWN0XFxcIjtcXG4gICAgICAgICAgICB2YXIgaSA9IFxcXCJ1bmRlZmluZWRcXFwiICE9IHR5cGVvZiBVaW50OEFycmF5ICYmIFxcXCJ1bmRlZmluZWRcXFwiICE9IHR5cGVvZiBVaW50MTZBcnJheSAmJiBcXFwidW5kZWZpbmVkXFxcIiAhPSB0eXBlb2YgSW50MzJBcnJheTtcXG4gICAgICAgICAgICBhLmFzc2lnbiA9IGZ1bmN0aW9uKHQpIHtcXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgZSwgYSwgaSA9IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMSk7IGkubGVuZ3RoOykge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpLnNoaWZ0KCk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAobikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChcXFwib2JqZWN0XFxcIiAhPSB0eXBlb2YgbikgdGhyb3cgbmV3IFR5cGVFcnJvcihuICsgXFxcIm11c3QgYmUgbm9uLW9iamVjdFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gbikgZSA9IG4sIGEgPSByLCBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSwgYSkgJiYgKHRbcl0gPSBuW3JdKVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiB0XFxuICAgICAgICAgICAgfSwgYS5zaHJpbmtCdWYgPSBmdW5jdGlvbih0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0Lmxlbmd0aCA9PT0gZSA/IHQgOiB0LnN1YmFycmF5ID8gdC5zdWJhcnJheSgwLCBlKSA6ICh0Lmxlbmd0aCA9IGUsIHQpXFxuICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICB2YXIgbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgIGFycmF5U2V0OiBmdW5jdGlvbih0LCBlLCBhLCBpLCBuKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuc3ViYXJyYXkgJiYgdC5zdWJhcnJheSkgdC5zZXQoZS5zdWJhcnJheShhLCBhICsgaSksIG4pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IDA7IHIgPCBpOyByKyspIHRbbiArIHJdID0gZVthICsgcl1cXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICBmbGF0dGVuQ2h1bmtzOiBmdW5jdGlvbih0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIGEsIGksIG4sIHIsIHM7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlID0gaSA9IDAsIGEgPSB0Lmxlbmd0aDsgZSA8IGE7IGUrKykgaSArPSB0W2VdLmxlbmd0aDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHMgPSBuZXcgVWludDhBcnJheShpKSwgZSA9IG4gPSAwLCBhID0gdC5sZW5ndGg7IGUgPCBhOyBlKyspIHIgPSB0W2VdLCBzLnNldChyLCBuKSwgbiArPSByLmxlbmd0aDtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICByID0ge1xcbiAgICAgICAgICAgICAgICAgICAgYXJyYXlTZXQ6IGZ1bmN0aW9uKHQsIGUsIGEsIGksIG4pIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IGk7IHIrKykgdFtuICsgcl0gPSBlW2EgKyByXVxcbiAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIGZsYXR0ZW5DaHVua3M6IGZ1bmN0aW9uKHQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW10uY29uY2F0LmFwcGx5KFtdLCB0KVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIGEuc2V0VHlwZWQgPSBmdW5jdGlvbih0KSB7XFxuICAgICAgICAgICAgICAgIHQgPyAoYS5CdWY4ID0gVWludDhBcnJheSwgYS5CdWYxNiA9IFVpbnQxNkFycmF5LCBhLkJ1ZjMyID0gSW50MzJBcnJheSwgYS5hc3NpZ24oYSwgbikpIDogKGEuQnVmOCA9IEFycmF5LCBhLkJ1ZjE2ID0gQXJyYXksIGEuQnVmMzIgPSBBcnJheSwgYS5hc3NpZ24oYSwgcikpXFxuICAgICAgICAgICAgfSwgYS5zZXRUeXBlZChpKVxcbiAgICAgICAgfSwge31dLFxcbiAgICAgICAgNDogW2Z1bmN0aW9uKHQsIGUsIGEpIHtcXG4gICAgICAgICAgICBcXFwidXNlIHN0cmljdFxcXCI7XFxuICAgICAgICAgICAgdmFyIGwgPSB0KFxcXCIuL2NvbW1vblxcXCIpLFxcbiAgICAgICAgICAgICAgICBuID0gITAsXFxuICAgICAgICAgICAgICAgIHIgPSAhMDtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KG51bGwsIFswXSlcXG4gICAgICAgICAgICB9IGNhdGNoICh0KSB7XFxuICAgICAgICAgICAgICAgIG4gPSAhMVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KG51bGwsIG5ldyBVaW50OEFycmF5KDEpKVxcbiAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHtcXG4gICAgICAgICAgICAgICAgciA9ICExXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGZvciAodmFyIGggPSBuZXcgbC5CdWY4KDI1NiksIGkgPSAwOyBpIDwgMjU2OyBpKyspIGhbaV0gPSAyNTIgPD0gaSA/IDYgOiAyNDggPD0gaSA/IDUgOiAyNDAgPD0gaSA/IDQgOiAyMjQgPD0gaSA/IDMgOiAxOTIgPD0gaSA/IDIgOiAxO1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGQodCwgZSkge1xcbiAgICAgICAgICAgICAgICBpZiAoZSA8IDY1NTM0ICYmICh0LnN1YmFycmF5ICYmIHIgfHwgIXQuc3ViYXJyYXkgJiYgbikpIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KG51bGwsIGwuc2hyaW5rQnVmKHQsIGUpKTtcXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IFxcXCJcXFwiLCBpID0gMDsgaSA8IGU7IGkrKykgYSArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHRbaV0pO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gYVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBoWzI1NF0gPSBoWzI1NF0gPSAxLCBhLnN0cmluZzJidWYgPSBmdW5jdGlvbih0KSB7XFxuICAgICAgICAgICAgICAgIHZhciBlLCBhLCBpLCBuLCByLCBzID0gdC5sZW5ndGgsXFxuICAgICAgICAgICAg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gICAgICAgIH0sIGEuYmluc3RyaW5nMmJ1ZiA9IGZ1bmN0aW9uKHQpIHtcXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IG5ldyBsLkJ1ZjgodC5sZW5ndGgpLCBhID0gMCwgaSA9IGUubGVuZ3RoOyBhIDwgaTsgYSsrKSBlW2FdID0gdC5jaGFyQ29kZUF0KGEpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gZVxcbiAgICAgICAgICAgIH0sIGEuYnVmMnN0cmluZyA9IGZ1bmN0aW9uKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGEsIGksIG4sIHIsIHMgPSBlIHx8IHQubGVuZ3RoLFxcbiAgICAgICAgICAgICAgICAgICAgbyA9IG5ldyBBcnJheSgyICogcyk7XFxuICAgICAgICAgICAgICAgIGZvciAoYSA9IGkgPSAwOyBhIDwgczspXFxuICAgICAgICAgICAgICAgICAgICBpZiAoKG4gPSB0W2ErK10pIDwgMTI4KSBvW2krK10gPSBuO1xcbiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoNCA8IChyID0gaFtuXSkpIG9baSsrXSA9IDY1NTMzLCBhICs9IHIgLSAxO1xcbiAgICAgICAgICAgICAgICBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAobiAmPSAyID09PSByID8gMzEgOiAzID09PSByID8gMTUgOiA3OyAxIDwgciAmJiBhIDwgczspIG4gPSBuIDw8IDYgfCA2MyAmIHRbYSsrXSwgci0tO1xcbiAgICAgICAgICAgICAgICAgICAgMSA8IHIgPyBvW2krK10gPSA2NTUzMyA6IG4gPCA2NTUzNiA/IG9baSsrXSA9IG4gOiAobiAtPSA2NTUzNiwgb1tpKytdID0gNTUyOTYgfCBuID4+IDEwICYgMTAyMywgb1tpKytdID0gNTYzMjAgfCAxMDIzICYgbilcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXR1cm4gZChvLCBpKVxcbiAgICAgICAgICAgIH0sIGEudXRmOGJvcmRlciA9IGZ1bmN0aW9uKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGE7XFxuICAgICAgICAgICAgICAgIGZvciAoKGUgPSBlIHx8IHQubGVuZ3RoKSA+IHQubGVuZ3RoICYmIChlID0gdC5sZW5ndGgpLCBhID0gZSAtIDE7IDAgPD0gYSAmJiAxMjggPT0gKDE5MiAmIHRbYV0pOykgYS0tO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gYSA8IDAgPyBlIDogMCA9PT0gYSA/IGUgOiBhICsgaFt0W2FdXSA+IGUgPyBhIDogZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHtcXG4gICAgICAgICAgICBcXFwiLi9jb21tb25cXFwiOiAzXFxuICAgICAgICB9XSxcXG4gICAgICAgIDU6IFtmdW5jdGlvbih0LCBlLCBhKSB7XFxuICAgICAgICAgICAgXFxcInVzZSBzdHJpY3RcXFwiO1xcbiAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uKHQsIGUsIGEsIGkpIHtcXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDY1NTM1ICYgdCB8IDAsIHIgPSB0ID4+PiAxNiAmIDY1NTM1IHwgMCwgcyA9IDA7IDAgIT09IGE7KSB7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGEgLT0gcyA9IDJlMyA8IGEgPyAyZTMgOiBhOyByID0gciArIChuID0gbiArIGVbaSsrXSB8IDApIHwgMCwgLS1zOyk7XFxuICAgICAgICAgICAgICAgICAgICBuICU9IDY1NTIxLCByICU9IDY1NTIxXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIG4gfCByIDw8IDE2IHwgMFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHt9XSxcXG4gICAgICAgIDY6IFtmdW5jdGlvbih0LCBlLCBhKSB7XFxuICAgICAgICAgICAgXFxcInVzZSBzdHJpY3RcXFwiO1xcbiAgICAgICAgICAgIGUuZXhwb3J0cyA9IHtcXG4gICAgICAgICAgICAgICAgWl9OT19GTFVTSDogMCxcXG4gICAgICAgICAgICAgICAgWl9QQVJUSUFMX0ZMVVNIOiAxLFxcbiAgICAgICAgICAgICAgICBaX1NZTkNfRkxVU0g6IDIsXFxuICAgICAgICAgICAgICAgIFpfRlVMTF9GTFVTSDogMyxcXG4gICAgICAgICAgICAgICAgWl9GSU5JU0g6IDQsXFxuICAgICAgICAgICAgICAgIFpfQkxPQ0s6IDUsXFxuICAgICAgICAgICAgICAgIFpfVFJFRVM6IDYsXFxuICAgICAgICAgICAgICAgIFpfT0s6IDAsXFxuICAgICAgICAgICAgICAgIFpfU1RSRUFNX0VORDogMSxcXG4gICAgICAgICAgICAgICAgWl9ORUVEX0RJQ1Q6IDIsXFxuICAgICAgICAgICAgICAgIFpfRVJSTk86IC0xLFxcbiAgICAgICAgICAgICAgICBaX1NUUkVBTV9FUlJPUjogLTIsXFxuICAgICAgICAgICAgICAgIFpfREFUQV9FUlJPUjogLTMsXFxuICAgICAgICAgICAgICAgIFpfQlVGX0VSUk9SOiAtNSxcXG4gICAgICAgICAgICAgICAgWl9OT19DT01QUkVTU0lPTjogMCxcXG4gICAgICAgICAgICAgICAgWl9CRVNUX1NQRUVEOiAxLFxcbiAgICAgICAgICAgICAgICBaX0JFU1RfQ09NUFJFU1NJT046IDksXFxuICAgICAgICAgICAgICAgIFpfREVGQVVMVF9DT01QUkVTU0lPTjogLTEsXFxuICAgICAgICAgICAgICAgIFpfRklMVEVSRUQ6IDEsXFxuICAgICAgICAgICAgICAgIFpfSFVGRk1BTl9PTkxZOiAyLFxcbiAgICAgICAgICAgICAgICBaX1JMRTogMyxcXG4gICAgICAgICAgICAgICAgWl9GSVhFRDogNCxcXG4gICAgICAgICAgICAgICAgWl9ERUZBVUxUX1NUUkFURUdZOiAwLFxcbiAgICAgICAgICAgICAgICBaX0JJTkFSWTogMCxcXG4gICAgICAgICAgICAgICAgWl9URVhUOiAxLFxcbiAgICAgICAgICAgICAgICBaX1VOS05PV046IDIsXFxuICAgICAgICAgICAgICAgIFpfREVGTEFURUQ6IDhcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCB7fV0sXFxuICAgICAgICA3OiBbZnVuY3Rpb24odCwgZSwgYSkge1xcbiAgICAgICAgICAgIFxcXCJ1c2Ugc3RyaWN0XFxcIjtcXG4gICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uKCkge1xcbiAgICAgICAgICAgICAgICBmb3IgKHZhciB0LCBlID0gW10sIGEgPSAwOyBhIDwgMjU2OyBhKyspIHtcXG4gICAgICAgICAgICAgICAgICAgIHQgPSBhO1xcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCA4OyBpKyspIHQgPSAxICYgdCA/IDM5ODgyOTIzODQgXiB0ID4+PiAxIDogdCA+Pj4gMTtcXG4gICAgICAgICAgICAgICAgICAgIGVbYV0gPSB0XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVcXG4gICAgICAgICAgICB9KCk7XFxuICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24odCwgZSwgYSwgaSkge1xcbiAgICAgICAgICAgICAgICB2YXIgbiA9IG8sXFxuICAgICAgICAgICAgICAgICAgICByID0gaSArIGE7XFxuICAgICAgICAgICAgICAgIHQgXj0gLTE7XFxuICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSBpOyBzIDwgcjsgcysrKSB0ID0gdCA+Pj4gOCBeIG5bMjU1ICYgKHQgXiBlW3NdKV07XFxuICAgICAgICAgICAgICAgIHJldHVybiAtMSBeIHRcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCB7fV0sXFxuICAgICAgICA4OiBbZnVuY3Rpb24odCwgZSwgYSkge1xcbiAgICAgICAgICAgIFxcXCJ1c2Ugc3RyaWN0XFxcIjtcXG4gICAgICAgICAgICB2YXIgbCwgXyA9IHQoXFxcIi4uL3V0aWxzL2NvbW1vblxcXCIpLFxcbiAgICAgICAgICAgICAgICBoID0gdChcXFwiLi90cmVlc1xcXCIpLFxcbiAgICAgICAgICAgICAgICB1ID0gdChcXFwiLi9hZGxlcjMyXFxcIiksXFxuICAgICAgICAgICAgICAgIGMgPSB0KFxcXCIuL2NyYzMyXFxcIiksXFxuICAgICAgICAgICAgICAgIGkgPSB0KFxcXCIuL21lc3NhZ2VzXFxcIiksXFxuICAgICAgICAgICAgICAgIGQgPSAwLFxcbiAgICAgICAgICAgICAgICBmID0gNCxcXG4gICAgICAgICAgICAgICAgYiA9IDAsXFxuICAgICAgICAgICAgICAgIGcgPSAtMixcXG4gICAgICAgICAgICAgICAgbSA9IC0xLFxcbiAgICAgICAgICAgICAgICB3ID0gNCxcXG4gICAgICAgICAgICAgICAgbiA9IDIsXFxuICAgICAgICAgICAgICAgIHAgPSA4LFxcbiAgICAgICAgICAgICAgICB2ID0gOSxcXG4gICAgICAgICAgICAgICAgciA9IDI4NixcXG4gICAgICAgICAgICAgICAgcyA9IDMwLFxcbiAgICAgICAgICAgICAgICBvID0gMTksXFxuICAgICAgICAgICAgICAgIGsgPSAyICogciArIDEsXFxuICAgICAgICAgICAgICAgIHkgPSAxNSxcXG4gICAgICAgICAgICAgICAgeCA9IDMsXFxuICAgICAgICAgICAgICAgIHogPSAyNTgsXFxuICAgICAgICAgICAgICAgIEIgPSB6ICsgeCArIDEsXFxuICAgICAgICAgICAgICAgIFMgPSA0MixcXG4gICAgICAgICAgICAgICAgRSA9IDExMyxcXG4gICAgICAgICAgICAgICAgQSA9IDEsXFxuICAgICAgICAgICAgICAgIFogPSAyLFxcbiAgICAgICAgICAgICAgICBSID0gMyxcXG4gICAgICAgICAgICAgICAgQyA9IDQ7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gTih0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0Lm1zZyA9IGlbZV0sIGVcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gTyh0KSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAodCA8PCAxKSAtICg0IDwgdCA/IDkgOiAwKVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBEKHQpIHtcXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHQubGVuZ3RoOyAwIDw9IC0tZTspIHRbZV0gPSAwXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIEkodCkge1xcbiAgICAgICAgICAgICAgICB2YXIgZSA9IHQuc3RhdGUsXFxuICAgICAgICAgICAgICAgICAgICBhID0gZS5wZW5kaW5nO1xcbiAgICAgICAgICAgICAgICBhID4gdC5hdmFpbF9vdXQgJiYgKGEgPSB0LmF2YWlsX291dCksIDAgIT09IGEgJiYgKF8uYXJyYXlTZXQodC5vdXRwdXQsIGUucGVuZGluZ19idWYsIGUucGVuZGluZ19vdXQsIGEsIHQubmV4dF9vdXQpLCB0Lm5leHRfb3V0ICs9IGEsIGUucGVuZGluZ19vdXQgKz0gYSwgdC50b3RhbF9vdXQgKz0gYSwgdC5hdmFpbF9vdXQgLT0gYSwgZS5wZW5kaW5nIC09IGEsIDAgPT09IGUucGVuZGluZyAmJiAoZS5wZW5kaW5nX291dCA9IDApKVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBVKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgaC5fdHJfZmx1c2hfYmxvY2sodCwgMCA8PSB0LmJsb2NrX3N0YXJ0ID8gdC5ibG9ja19zdGFydCA6IC0xLCB0LnN0cnN0YXJ0IC0gdC5ibG9ja19zdGFydCwgZSksIHQuYmxvY2tfc3RhcnQgPSB0LnN0cnN0YXJ0LCBJKHQuc3RybSlcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gVCh0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHQucGVuZGluZ19idWZbdC5wZW5kaW5nKytdID0gZVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBGKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgdC5wZW5kaW5nX2J1Zlt0LnBlbmRpbmcrK10gPSBlID4+PiA4ICYgMjU1LCB0LnBlbmRpbmdfYnVmW3QucGVuZGluZysrXSA9IDI1NSAmIGVcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gTCh0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHZhciBhLCBpLCBuID0gdC5tYXhfY2hhaW5fbGVuZ3RoLFxcbiAgICAgICAgICAgICAgICAgICAgciA9IHQuc3Ryc3RhcnQsXFxuICAgICAgICAgICAgICAgICAgICBzID0gdC5wcmV2X2xlbmd0aCxcXG4gICAgICAgICAgICAgICAgICAgIG8gPSB0Lm5pY2VfbWF0Y2gsXFxuICAgICAgICAgICAgICAgICAgICBsID0gdC5zdHJzdGFydCA+IHQud19zaXplIC0gQiA/IHQuc3Ryc3RhcnQgLSAodC53X3NpemUgLSBCKSA6IDAsXFxuICAgICAgICAgICAgICAgICAgICBoID0gdC53aW5kb3csXFxuICAgICAgICAgICAgICAgICAgICBkID0gdC53X21hc2ssXFxuICAgICAgICAgICAgICAgICAgICBmID0gdC5wcmV2LFxcbiAgICAgICAgICAgICAgICAgICAgXyA9IHQuc3Ryc3RhcnQgKyB6LFxcbiAgICAgICAgICAgICAgICAgICAgdSA9IGhbciArIHMgLSAxXSxcXG4gICAgICAgICAgICAgICAgICAgIGMgPSBoW3IgKyBzXTtcXG4gICAgICAgICAgICAgICAgdC5wcmV2X2xlbmd0aCA+PSB0Lmdvb2RfbWF0Y2ggJiYgKG4gPj49IDIpLCBvID4gdC5sb29rYWhlYWQgJiYgKG8gPSB0Lmxvb2thaGVhZCk7XFxuICAgICAgICAgICAgICAgIGRvIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChoWyhhID0gZSkgKyBzXSA9PT0gYyAmJiBoW2EgKyBzIC0gMV0gPT09IHUgJiYgaFthXSA9PT0gaFtyXSAmJiBoWysrYV0gPT09IGhbciArIDFdKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgciArPSAyLCBhKys7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZG8ge30gd2hpbGUgKGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIGhbKytyXSA9PT0gaFsrK2FdICYmIHIgPCBfKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA9IHogLSAoXyAtIHIpLCByID0gXyAtIHosIHMgPCBpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0Lm1hdGNoX3N0YXJ0ID0gZSwgbyA8PSAocyA9IGkpKSBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdSA9IGhbciArIHMgLSAxXSwgYyA9IGhbciArIHNdXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9IHdoaWxlICgoZSA9IGZbZSAmIGRdKSA+IGwgJiYgMCAhPSAtLW4pO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gcyA8PSB0Lmxvb2thaGVhZCA/IHMgOiB0Lmxvb2thaGVhZFxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBIKHQpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGUsIGEsIGksIG4sIHIsIHMsIG8sIGwsIGgsIGQsIGYgPSB0Lndfc2l6ZTtcXG4gICAgICAgICAgICAgICAgZG8ge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSB0LndpbmRvd19zaXplIC0gdC5sb29rYWhlYWQgLSB0LnN0cnN0YXJ0LCB0LnN0cnN0YXJ0ID49IGYgKyAoZiAtIEIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChfLmFycmF5U2V0KHQud2luZG93LCB0LndpbmRvdywgZiwgZiwgMCksIHQubWF0Y2hfc3RhcnQgLT0gZiwgdC5zdHJzdGFydCAtPSBmLCB0LmJsb2NrX3N0YXJ0IC09IGYsIGUgPSBhID0gdC5oYXNoX3NpemU7IGkgPSB0LmhlYWRbLS1lXSwgdC5oZWFkW2VdID0gZiA8PSBpID8gaSAtIGYgOiAwLCAtLWE7KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSBhID0gZjsgaSA9IHQucHJldlstLWVdLCB0LnByZXZbZV0gPSBmIDw9IGkgPyBpIC0gZiA6IDAsIC0tYTspO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIG4gKz0gZlxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IHQuc3RybS5hdmFpbF9pbikgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICBpZiAocyA9IHQuc3RybSwgbyA9IHQud2luZG93LCBsID0gdC5zdHJzdGFydCArIHQubG9va2FoZWFkLCBoID0gbiwgZCA9IHZvaWQgMCwgZCA9IHMuYXZhaWxfaW4sIGggPCBkICYmIChkID0gaCksIGEgPSAwID09PSBkID8gMCA6IChzLmF2YWlsX2luIC09IGQsIF8uYXJyYXlTZXQobywgcy5pbnB1dCwgcy5uZXh0X2luLCBkLCBsKSwgMSA9PT0gcy5zdGF0ZS53cmFwID8gcy5hZGxlciA9IHUocy5hZGxlciwgbywgZCwgbCkgOiAyID09PSBzLnN0YXRlLndyYXAgJiYgKHMuYWRsZXIgPSBjKHMuYWRsZXIsIG8sIGQsIGwpKSwgcy5uZXh0X2luICs9IGQsIHMudG90YWxfaW4gKz0gZCwgZCksIHQubG9va2FoZWFkICs9IGEsIHQubG9va2FoZWFkICsgdC5pbnNlcnQgPj0geClcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgPSB0LnN0cnN0YXJ0IC0gdC5pbnNlcnQsIHQuaW5zX2ggPSB0LndpbmRvd1tyXSwgdC5pbnNfaCA9ICh0Lmluc19oIDw8IHQuaGFzaF9zaGlmdCBeIHQud2luZG93W3IgKyAxXSkgJiB0Lmhhc2hfbWFzazsgdC5pbnNlcnQgJiYgKHQuaW5zX2ggPSAodC5pbnNfaCA8PCB0Lmhhc2hfc2hpZnQgXiB0LndpbmRvd1tyICsgeCAtIDFdKSAmIHQuaGFzaF9tYXNrLCB0LnByZXZbciAmIHQud19tYXNrXSA9IHQuaGVhZFt0Lmluc19oXSwgdC5oZWFkW3QuaW5zX2hdID0gciwgcisrLCB0Lmluc2VydC0tLCAhKHQubG9va2FoZWFkICsgdC5pbnNlcnQgPCB4KSk7KTtcXG4gICAgICAgICAgICAgICAgfSB3aGlsZSAodC5sb29rYWhlYWQgPCBCICYmIDAgIT09IHQuc3RybS5hdmFpbF9pbilcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gaih0LCBlKSB7XFxuICAgICAgICAgICAgICAgIGZvciAodmFyIGEsIGk7Oykge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHQubG9va2FoZWFkIDwgQikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChIKHQpLCB0Lmxvb2thaGVhZCA8IEIgJiYgZSA9PT0gZCkgcmV0dXJuIEE7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IHQubG9va2FoZWFkKSBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGEgPSAwLCB0Lmxvb2thaGVhZCA+PSB4ICYmICh0Lmluc19oID0gKHQuaW5zX2ggPDwgdC5oYXNoX3NoaWZ0I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mRvd1t0LnN0cnN0YXJ0XSwgdC5pbnNfaCA9ICh0Lmluc19oIDw8IHQuaGFzaF9zaGlmdCBeIHQud2luZG93W3Quc3Ryc3RhcnQgKyAxXSkgJiB0Lmhhc2hfbWFzaztcXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgaSA9IGguX3RyX3RhbGx5KHQsIDAsIHQud2luZG93W3Quc3Ryc3RhcnRdKSwgdC5sb29rYWhlYWQtLSwgdC5zdHJzdGFydCsrO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgJiYgKFUodCwgITEpLCAwID09PSB0LnN0cm0uYXZhaWxfb3V0KSkgcmV0dXJuIEFcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXR1cm4gdC5pbnNlcnQgPSB0LnN0cnN0YXJ0IDwgeCAtIDEgPyB0LnN0cnN0YXJ0IDogeCAtIDEsIGUgPT09IGYgPyAoVSh0LCAhMCksIDAgPT09IHQuc3RybS5hdmFpbF9vdXQgPyBSIDogQykgOiB0Lmxhc3RfbGl0ICYmIChVKHQsICExKSwgMCA9PT0gdC5zdHJtLmF2YWlsX291dCkgPyBBIDogWlxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBLKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgYSwgaSwgbjs7KSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAodC5sb29rYWhlYWQgPCBCKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEgodCksIHQubG9va2FoZWFkIDwgQiAmJiBlID09PSBkKSByZXR1cm4gQTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gdC5sb29rYWhlYWQpIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IDAsIHQubG9va2FoZWFkID49IHggJiYgKHQuaW5zX2ggPSAodC5pbnNfaCA8PCB0Lm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LnBlbmRpbmdfYnVmID0gbmV3IF8uQnVmOChvLnBlbmRpbmdfYnVmX3NpemUpLCBvLmRfYnVmID0gMSAqIG8ubGl0X2J1ZnNpemUsIG8ubF9idWYgPSAzICogby5saXRfYnVmc2l6ZSwgby5sZXZlbCA9IGUsIG8uc3RyYXRlZ3kgPSByLCBvLm1ldGhvZCA9IGEsIHEodClcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbCA9IFtuZXcgTSgwLCAwLCAwLCAwLCBmdW5jdGlvbih0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHZhciBhID0gNjU1MzU7XFxuICAgICAgICAgICAgICAgIGZvciAoYSA+IHQucGVuZGluZ19idWZfc2l6ZSAtIDUgJiYgKGEgPSB0LnBlbmRpbmdfYnVmX3NpemUgLSA1KTs7KSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAodC5sb29rYWhlYWQgPD0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChIKHQpLCAwID09PSB0Lmxvb2thaGVhZCAmJiBlID09PSBkKSByZXR1cm4gQTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gdC5sb29rYWhlYWQpIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB0LnN0cnN0YXJ0ICs9IHQubG9va2FoZWFkLCB0Lmxvb2thaGVhZCA9IDA7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHQuYmxvY2tfc3RhcnQgKyBhO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKCgwID09PSB0LnN0cnN0YXJ0IHx8IHQuc3Ryc3RhcnQgPj0gaSkgJiYgKHQubG9va2FoZWFkID0gdC5zdHJzdGFydCAtIGksIHQuc3Ryc3RhcnQgPSBpLCBVKHQsICExKSwgMCA9PT0gdC5zdHJtLmF2YWlsX291dCkpIHJldHVybiBBO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHQuc3Ryc3R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YWRsZXIsIGkucGVuZGluZ19idWYsIGkucGVuZGluZyAtIG4sIG4pKSwgSSh0KSwgbiA9IGkucGVuZGluZywgaS5wZW5kaW5nID09PSBpLnBlbmRpbmdfYnVmX3NpemUpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gMTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgVChpLCByID0gaS5nemluZGV4IDwgaS5nemhlYWQubmFtZS5sZW5ndGggPyAyNTUgJiBpLmd6aGVhZC5uYW1lLmNoYXJDb2RlQXQoaS5nemluZGV4KyspIDogMClcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgwICE9PSByKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpLmd6aGVhZC5oY3JjICYmIGkucGVuZGluZyA+IG4gJiYgKHQuYWRsZXIgPSBjKHQuYWRsZXIsIGkucGVuZGluZ19idWYsIGkucGVuZGluZyAtIG4sIG4pKSwgMCA9PT0gciAmJiAoaS5nemluZGV4ID0gMCwgaS5zdGF0dXMgPSA5MSlcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpLnN0YXR1cyA9IDkxO1xcbiAgICAgICAgICAgICAgICBpZiAoOTEgPT09IGkuc3RhdHVzKVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkuZ3poZWFkLmNvbW1lbnQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBuID0gaS5wZW5kaW5nO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkucGVuZGluZyA9PT0gaS5wZW5kaW5nX2J1Zl9zaXplICYmIChpLmd6aGVhZC5oY3JjICYmIGkucGVuZGluZyA+IG4gJiYgKHQuYWRsZXIgPSBjKHQuYWRsZXIsIGkucGVuZGluZ19idWYsIGkucGVuZGluZyAtIG4sIG4pKSwgSSh0KSwgbiA9IGkucGVuZGluZywgaS5wZW5kaW5nID09PSBpLnBlbmRpbmdfYnVmX3NpemUpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gMTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgVChpLCByID0gaS5nemluZGV4IDwgaS5nemhlYWQuY29tbWVudC5sZW5ndGggPyAyNTUgJiBpLmd6aGVhZC5jb21tZW50LmNoYXJDb2RlQXQoaS5nemluZGV4KyspIDogMClcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgwICE9PSByKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpLmd6aGVhZC5oY3JjICYmIGkucGVuZGluZyA+IG4gJiYgKHQuYWRsZXIgPSBjKHQuYWRsZXIsIGkucGVuZGluZ19idWYsIGkucGVuZGluZyAtIG4sIG4pKSwgMCA9PT0gciAmJiAoaS5zdGF0dXMgPSAxMDMpXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaS5zdGF0dXMgPSAxMDM7XFxuICAgICAgICAgICAgICAgIGlmICgxMDMgPT09IGkuc3RhdHVzICYmIChpLmd6aGVhZC5oY3JjID8gKGkucGVuZGluZyArIDIgPiBpLnBlbmRpbmdfYnVmX3NpemUgJiYgSSh0KSwgaS5wZW5kaW5nICsgMiA8PSBpLnBlbmRpbmdfYnVmX3NpemUgJiYgKFQoaSwgMjU1ICYgdC5hZGxlciksIFQoaSwgdC5hZGxlciA+PiA4ICYgMjU1KSwgdC5hZGxlciA9IDAsIGkuc3RhdHVzID0gRSkpIDogaS5zdGF0dXMgPSBFKSwgMCAhPT0gaS5wZW5kaW5nKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoSSh0KSwgMCA9PT0gdC5hdmFpbF9vdXQpIHJldHVybiBpLmxhc3RfZmx1c2ggPSAtMSwgYlxcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKDAgPT09IHQuYXZhaWxfaW4gJiYgTyhlKSA8PSBPKGEpICYmIGUgIT09IGYpIHJldHVybiBOKHQsIC01KTtcXG4gICAgICAgICAgICAgICAgaWYgKDY2NiA9PT0gaS5zdGF0dXMgJiYgMCAhPT0gdC5hdmFpbF9pbikgcmV0dXJuIE4odCwgLTUpO1xcbiAgICAgICAgICAgICAgICBpZiAoMCAhPT0gdC5hdmFpbF9pbiB8fCAwICE9PSBpLmxvb2thaGVhZCB8fCBlICE9PSBkICYmIDY2NiAhPT0gaS5zdGF0dXMpIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBvID0gMiA9PT0gaS5zdHJhdGVneSA/IGZ1bmN0aW9uKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhOzspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IHQubG9va2FoZWFkICYmIChIKHQpLCAwID09PSB0Lmxvb2thaGVhZCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSBkKSByZXR1cm4gQTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQubWF0Y2hfbGVuZ3RoID0gMCwgYSA9IGguX3RyX3RhbGx5KHQsIDAsIHQud2luZG93W3Quc3Ryc3RhcnRdKSwgdC5sb29rYWhlYWQtLSwgdC5zdHJzdGFydCsrLCBhICYmIChVKHQsICExKSwgMCA9PT0gdC5zdHJtLmF2YWlsX291dCkpIHJldHVybiBBXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lmluc2VydCA9IDAsIGUgPT09IGYgPyAoVSh0LCAhMCksIDAgPT09IHQuc3RybS5hdmFpbF9vdXQgPyBSIDogQykgOiB0Lmxhc3RfbGl0ICYmIChVKHQsICExKSwgMCA9PT0gdC5zdHJtLmF2YWlsX291dCkgPyBBIDogWlxcbiAgICAgICAgICAgICAgICAgICAgfShpLCBlKSA6IDMgPT09IGkuc3RyYXRlZ3kgPyBmdW5jdGlvbih0LCBlKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSwgaSwgbiwgciwgcyA9IHQud2luZG93OzspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQubG9va2FoZWFkIDw9IHopIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChIKHQpLCB0Lmxvb2thaGVhZCA8PSB6ICYmIGUgPT09IGQpIHJldHVybiBBO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IHQubG9va2FoZWFkKSBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0Lm1hdGNoX2xlbmd0aCA9IDAsIHQubG9va2FoZWFkID49IHggJiYgMCA8IHQuc3Ryc3RhcnQgJiYgKGkgPSBzW24gPSB0LnN0cnN0YXJ0IC0gMV0pID09PSBzWysrbl0gJiYgaSA9PT0gc1srK25dICYmIGkgPT09IHNbKytuXSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHQuc3Ryc3RhcnQgKyB6O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8ge30gd2hpbGUgKGkgPT09IHNbKytuXSAmJiBpID09PSBzWysrbl0gJiYgaSA9PT0gc1srK25dICYmIGkgPT09IHNbKytuXSAmJiBpID09PSBzWysrbl0gJiYgaSA9PT0gc1srK25dICYmIGkgPT09IHNbKytuXSAmJiBpID09PSBzWysrbl0gJiYgbiA8IHIpO1xcbiAg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AgICAgICAgICAgdDogZG8ge1xcbiAgICAgICAgICAgICAgICAgICAgYyA8IDE1ICYmICh1ICs9IEJbaSsrXSA8PCBjLCBjICs9IDgsIHUgKz0gQltpKytdIDw8IGMsIGMgKz0gOCksIHAgPSBiW3UgJiBtXTtcXG4gICAgICAgICAgICAgICAgICAgIGU6IGZvciAoOzspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodSA+Pj49IHYgPSBwID4+PiAyNCwgYyAtPSB2LCAwID09PSAodiA9IHAgPj4+IDE2ICYgMjU1KSkgU1tyKytdID0gNjU1MzUgJiBwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISgxNiAmIHYpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSAoNjQgJiB2KSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAgPSBiWyg2NTUzNSAmIHApICsgKHUgJiAoMSA8PCB2KSAtIDEpXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZSBlXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMzIgJiB2KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5tb2RlID0gMTI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlXFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgayA9IDY1NTM1ICYgcCwgKHYgJj0gMTUpICYmIChjIDwgdiAmJiAodSArPSBCW2krK10gPDwgYywgYyArPSA4KSwgayArPSB1ICYgKDEgPDwgdikgLSAxLCB1ID4+Pj0gdiwgYyAtPSB2KSwgYyA8IDE1ICYmICh1ICs9IEJbaSsrXSA8PCBjLCBjICs9IDgsIHUgKz0gQltpKytdIDw8IGMsIGMgKz0gOCksIHAgPSBnW3UgJiB3XTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYTogZm9yICg7Oykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUgPj4+PSB2ID0gcCA+Pj4gMjQsIGMgLT0gdiwgISgxNiAmICh2ID0gcCA+Pj4gMTYgJiAyNTUpKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09ICg2NCAmIHYpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAgPSBnWyg2NTUzNSAmIHApICsgKHUgJiAoMSA8PCB2KSAtIDEpXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWUgYVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1zZyA9IFxcXCJpbnZhbGlkIGRpc3RhbmNlIGNvZGVcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeSA9IDY1NTM1ICYgcCwgYyA8ICh2ICY9IDE1KSAmJiAodSArPSBCW2krK10gPDwgYywgKGMgKz0gOCkgPCB2ICYmICh1ICs9IEJbaSsrXSA8PCBjLCBjICs9IDgpKSwgbCA8ICh5ICs9IHUgJiAoMSA8PCB2KSAtIDEpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2tcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodSA+Pj49IHYsIGMgLT0gdiwgKHYgPSByIC0gcykgPCB5KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgPCAodiA9IHkgLSB2KSAmJiBhLnNhbmUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2tcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeiA9IF8sICh4ID0gMCkgPT09IGYpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHggKz0gaCAtIHYsIHYgPCBrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGsgLT0gdjsgU1tyKytdID0gX1t4KytdLCAtLXY7KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggPSByIC0geSwgeiA9IFNcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZiA8IHYpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHggKz0gaCArIGYgLSB2LCAodiAtPSBmKSA8IGspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoayAtPSB2OyBTW3IrK10gPSBfW3grK10sIC0tdjspO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHggPSAwLCBmIDwgaykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoayAtPSB2ID0gZjsgU1tyKytdID0gX1t4KytdLCAtLXY7KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ID0gciAtIHksIHogPSBTXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHggKz0gZiAtIHYsIHYgPCBrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoayAtPSB2OyBTW3IrK10gPSBfW3grK10sIC0tdjspO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ID0gciAtIHksIHogPSBTXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyAyIDwgazspIFNbcisrXSA9IHpbeCsrXSwgU1tyKytdID0gelt4KytdLCBTW3IrK10gPSB6W3grK10sIGsgLT0gMztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrICYmIChTW3IrK10gPSB6W3grK10sIDEgPCBrICYmIChTW3IrK10gPSB6W3grK10pKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHggPSByIC0geTsgU1tyKytdID0gU1t4KytdLCBTW3IrK10gPSBTW3grK10sIFNbcisrXSA9IFNbeCsrXSwgMiA8IChrIC09IDMpOyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgayAmJiAoU1tyKytdID0gU1t4KytdLCAxIDwgayAmJiAoU1tyKytdID0gU1t4KytdKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSB3aGlsZSAoaSA8IG4gJiYgciA8IG8pO1xcbiAgICAgICAgICAgICAgICBpIC09IGsgPSBjID4+IDMsIHUgJj0gKDEgPDwgKGMgLT0gayA8PCAzKSkgLSAxLCB0Lm5leHRfaW4gPSBpLCB0Lm5leHRfb3V0ID0gciwgdC5hdmFpbF9pbiA9IGkgPCBuID8gbiAtIGkgKyA1IDogNSAtIChpIC0gbiksIHQuYXZhaWxfb3V0ID0gciA8IG8gPyBvIC0gciArIDI1NyA6IDI1NyAtIChyIC0gbyksIGEuaG9sZCA9IHUsIGEuYml0cyA9IGNcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCB7fV0sXFxuICAgICAgICAxMTogW2Z1bmN0aW9uKHQsIGUsIGEpIHtcXG4gICAgICAgICAgICBcXFwidXNlIHN0cmljdFxcXCI7XFxuICAgICAgICAgICAgdmFyIFogPSB0KFxcXCIuLi91dGlscy9jb21tb25cXFwiKSxcXG4gICAgICAgICAgICAgICAgUiA9IHQoXFxcIi4vYWRsZXIzMlxcXCIpLFxcbiAgICAgICAgICAgICAgICBDID0gdChcXFwiLi9jcmMzMlxcXCIpLFxcbiAgICAgICAgICAgICAgICBOID0gdChcXFwiLi9pbmZmYXN0XFxcIiksXFxuICAgICAgICAgICAgICAgIE8gPSB0KFxcXCIuL2luZnRyZWVzXFxcIiksXFxuICAgICAgICAgICAgICAgIEQgPSAxLFxcbiAgICAgICAgICAgICAgICBJID0gMixcXG4gICAgICAgICAgICAgICAgVSA9IDAsXFxuICAgICAgICAgICAgICAgIFQgPSAtMixcXG4gICAgICAgICAgICAgICAgRiA9IDEsXFxuICAgICAgICAgICAgICAgIGkgPSA4NTIsXFxuICAgICAgICAgICAgICAgIG4gPSA1OTI7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gTCh0KSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAodCA+Pj4gMjQgJiAyNTUpICsgKHQgPj4+IDggJiA2NTI4MCkgKyAoKDY1MjgwICYgdCkgPDwgOCkgKyAoKDI1NSAmIHQpIDw8IDI0KVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiByKCkge1xcbiAgICAgICAgICAgICAgICB0aGlzLm1vZGUgPSAwLCB0aGlzLmxhc3QgPSAhMSwgdGhpcy53cmFwID0gMCwgdGhpcy5oYXZlZGljdCA9ICExLCB0aGlzLmZsYWdzID0gMCwgdGhpcy5kbWF4ID0gMCwgdGhpcy5jaGVjayA9IDAsIHRoaXMudG90YWwgPSAwLCB0aGlzLmhlYWQgPSBudWxsLCB0aGlzLndiaXRzID0gMCwgdGhpcy53c2l6ZSA9IDAsIHRoaXMud2hhdmUgPSAwLCB0aGlzLnduZXh0ID0gMCwgdGhpcy53aW5kb3cgPSBudWxsLCB0aGlzLmhvbGQgPSAwLCB0aGlzLmJpdHMgPSAwLCB0aGlzLmxlbmd0aCA9IDAsIHRoaXMub2Zmc2V0ID0gMCwgdGh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gICAgICAgICAgICAgICByZXR1cm4gdCAmJiB0LnN0YXRlID8gKChlID0gdC5zdGF0ZSkud3NpemUgPSAwLCBlLndoYXZlID0gMCwgZS53bmV4dCA9IDAsIHModCkpIDogVFxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBsKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGEsIGk7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIHQuc3RhdGUgPyAoaSA9IHQuc3RhdGUsIGUgPCAwID8gKGEgPSAwLCBlID0gLWUpIDogKGEgPSAxICsgKGUgPj4gNCksIGUgPCA0OCAmJiAoZSAmPSAxNSkpLCBlICYmIChlIDwgOCB8fCAxNSA8IGUpID8gVCA6IChudWxsICE9PSBpLndpbmRvdyAmJiBpLndiaXRzICE9PSBlICYmIChpLndpbmRvdyA9IG51bGwpLCBpLndyYXAgPSBhLCBpLndiaXRzID0gZSwgbyh0KSkpIDogVFxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBoKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGEsIGk7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0ID8gKGkgPSBuZXcgciwgKHQuc3RhdGUgPSBpKS53aW5kb3cgPSBudWxsLCAoYSA9IGwodCwgZSkpICE9PSBVICYmICh0LnN0YXRlID0gbnVsbCksIGEpIDogVFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB2YXIgZCwgZiwgXyA9ICEwO1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIEgodCkge1xcbiAgICAgICAgICAgICAgICBpZiAoXykge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGU7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGQgPSBuZXcgWi5CdWYzMig1MTIpLCBmID0gbmV3IFouQnVmMzIoMzIpLCBlID0gMDsgZSA8IDE0NDspIHQubGVuc1tlKytdID0gODtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoOyBlIDwgMjU2OykgdC5sZW5zW2UrK10gPSA5O1xcbiAgICAgICAgICAgICAgICAgICAgZm9yICg7IGUgPCAyODA7KSB0LmxlbnNbZSsrXSA9IDc7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZSA8IDI4ODspIHQubGVuc1tlKytdID0gODtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoTyhELCB0LmxlbnMsIDAsIDI4OCwgZCwgMCwgdC53b3JrLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpdHM6IDlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSwgZSA9IDA7IGUgPCAzMjspIHQubGVuc1tlKytdID0gNTtcXG4gICAgICAgICAgICAgICAgICAgIE8oSSwgdC5sZW5zLCAwLCAzMiwgZiwgMCwgdC53b3JrLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYml0czogNVxcbiAgICAgICAgICAgICAgICAgICAgfSksIF8gPSAhMVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHQubGVuY29kZSA9IGQsIHQubGVuYml0cyA9IDksIHQuZGlzdGNvZGUgPSBmLCB0LmRpc3RiaXRzID0gNVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBqKHQsIGUsIGEsIGkpIHtcXG4gICAgICAgICAgICAgICAgdmFyIG4sIHIgPSB0LnN0YXRlO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gci53aW5kb3cgJiYgKHIud3NpemUgPSAxIDw8IHIud2JpdHMsIHIud25leHQgPSAwLCByLndoYXZlID0gMCwgci53aW5kb3cgPSBuZXcgWi5CdWY4KHIud3NpemUpKSwgaSA+PSByLndzaXplID8gKFouYXJyYXlTZXQoci53aW5kb3csIGUsIGEgLSByLndzaXplLCByLndzaXplLCAwKSwgci53bmV4dCA9IDAsIHIud2hhdmUgPSByLndzaXplKSA6IChpIDwgKG4gPSByLndzaXplIC0gci53bmV4dCkgJiYgKG4gPSBpKSwgWi5hcnJheVNldChyLndpbmRvdywgZSwgYSAtIGksIG4sIHIud25leHQpLCAoaSAtPSBuKSA/IChaLmFycmF5U2V0KHIud2luZG93LCBlLCBhIC0gaSwgaSwgMCksIHIud25leHQgPSBpLCByLndoYXZlID0gci53c2l6ZSkgOiAoci53bmV4dCArPSBuLCByLnduZXh0ID09PSByLndzaXplICYmIChyLnduZXh0ID0gMCksIHIud2hhdmUgPCByLndzaXplICYmIChyLndoYXZlICs9IG4pKSksIDBcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYS5pbmZsYXRlUmVzZXQgPSBvLCBhLmluZmxhdGVSZXNldDIgPSBsLCBhLmluZmxhdGVSZXNldEtlZXAgPSBzLCBhLmluZmxhdGVJbml0ID0gZnVuY3Rpb24odCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gaCh0LCAxNSlcXG4gICAgICAgICAgICB9LCBhLmluZmxhdGVJbml0MiA9IGgsIGEuaW5mbGF0ZSA9IGZ1bmN0aW9uKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGEsIGksIG4sIHIsIHMsIG8sIGwsIGgsIGQsIGYsIF8sIHUsIGMsIGIsIGcsIG0sIHcsIHAsIHYsIGssIHksIHgsIHosIEIsIFMgPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgRSA9IG5ldyBaLkJ1ZjgoNCksXFxuICAgICAgICAgICAgICAgICAgICBBID0gWzE2LCAxNywgMTgsIDAsIDgsIDcsIDksIDYsIDEwLCA1LCAxMSwgNCwgMTIsIDMsIDEzLCAyLCAxNCwgMSwgMTVdO1xcbiAgICAgICAgICAgICAgICBpZiAoIXQgfHwgIXQuc3RhdGUgfHwgIXQub3V0cHV0IHx8ICF0LmlucHV0ICYmIDAgIT09IHQuYXZhaWxfaW4pIHJldHVybiBUO1xcbiAgICAgICAgICAgICAgICAxMiA9PT0gKGEgPSB0LnN0YXRlKS5tb2RlICYmIChhLm1vZGUgPSAxMyksIHMgPSB0Lm5leHRfb3V0LCBuID0gdC5vdXRwdXQsIGwgPSB0LmF2YWlsX291dCwgciA9IHQubmV4dF9pbiwgaSA9IHQuaW5wdXQsIG8gPSB0LmF2YWlsX2luLCBoID0gYS5ob2xkLCBkID0gYS5iaXRzLCBmID0gbywgXyA9IGwsIHggPSBVO1xcbiAgICAgICAgICAgICAgICB0OiBmb3IgKDs7KSBzd2l0Y2ggKGEubW9kZSkge1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBGOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBhLndyYXApIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5tb2RlID0gMTM7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBkIDwgMTY7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoMiAmIGEud3JhcCAmJiAzNTYxNSA9PT0gaCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBFW2EuY2hlY2sgPSAwXSA9IDI1NSAmIGgsIEVbMV0gPSBoID4+PiA4ICYgMjU1LCBhLmNoZWNrID0gQyhhLmNoZWNrLCBFLCAyLCAwKSwgZCA9IGggPSAwLCBhLm1vZGUgPSAyO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5mbGFncyA9IDAsIGEuaGVhZCAmJiAoYS5oZWFkLmRvbmUgPSAhMSksICEoMSAmIGEud3JhcCkgfHwgKCgoMjU1ICYgaCkgPDwgOCkgKyAoaCA+PiA4KSkgJSAzMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1zZyA9IFxcXCJpbmNvcnJlY3QgaGVhZGVyIGNoZWNrXFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICg4ICE9ICgxNSAmIGgpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubXNnID0gXFxcInVua25vd24gY29tcHJlc3Npb24gbWV0aG9kXFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkIC09IDQsIHkgPSA4ICsgKDE1ICYgKGggPj4+PSA0KSksIDAgPT09IGEud2JpdHMpIGEud2JpdHMgPSB5O1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHkgPiBhLndiaXRzKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubXNnID0gXFxcImludmFsaWQgd2luZG93IHNpemVcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYS5kbWF4ID0gMSA8PCB5LCB0LmFkbGVyID0gYS5jaGVjayA9IDEsIGEubW9kZSA9IDUxMiAmIGggPyAxMCA6IDEyLCBkID0gaCA9IDA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDI6XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGQgPCAxNjspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8tLSwgaCArPSBpW3IrK10gPDwgZCwgZCArPSA4XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmZsYWdzID0gaCwgOCAhPSAoMjU1ICYgYS5mbGFncykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwidW5rbm93biBjb21wcmVzc2lvbiBtZXRob2RcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDU3MzQ0ICYgYS5mbGFncykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1zZyA9IFxcXCJ1bmtub3duIGhlYWRlciBmbGFncyBzZXRcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYS5oZWFkICYmIChhLmhlYWQudGV4dCA9IGggPj4gOCAmIDEpLCA1MTIgJiBhLmZsYWdzICYmIChFWzBdID0gMjU1ICYgaCwgRVsxXSA9IGggPj4+IDggJiAyNTUsIGEuY2hlY2sgPSBDKGEuY2hlY2ssIEUsIDIsIDApKSwgZCA9IGggPSAwLCBhLm1vZGUgPSAzO1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBkIDwgMzI7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBhLmhlYWQgJiYgKGEuaGVhZC50aW1lID0gaCksIDUxMiAmIGEuZmxhZ3MgJiYgKEVbMF0gPSAyNTUgJiBoLCBFWzFdID0gaCA+Pj4gOCAmIDI1NSwgRVsyXSA9IGggPj4+IDE2ICYgMjU1LCBFWzNdID0gaCA+Pj4gMjQgJiAyNTUsIGEuY2hlY2sgPSBDKGEuY2hlY2ssIEUsIDQsIDApKSwgZCA9IGggPSAwLCBhLm1vZGUgPSA0O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA0OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBkIDwgMTY7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBhLmhlYWQgJiYgKGEuaGVhZC54ZmxhZ3MgPSAyNTUgJiBoLCBhLmhlYWQub3MgPSBoID4+IDgpLCA1MTIgJiBhLmZsYWdzICYmIChFWzBdID0gMjU1ICYgaCwgRVsxXSA9IGggPj4+IDggJiAyNTUsIGEuY2hlY2sgPSBDKGEuY2hlY2ssIEUsIDIsIDApKSwgZCA9IGggPSAwLCBhLm1vZGUgPSA1O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA1OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxMDI0ICYgYS5mbGFncykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZCA8IDE2Oykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLS0sIGggKz0gaVtyKytdIDw8IGQsIGQgKz0gOFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubGVuZ3RoID0gaCwgYS5oZWFkICYmIChhLmhlYWQuZXh0cmFfbGVuID0gaCksIDUxMiAmIGEuZmxhZ3MgJiYgKEVbMF0gPSAyNTUgJiBoLCBFWzFdID0gaCA+Pj4gOCAmIDI1NSwgYS5jaGVjayA9IEMoYS5jaGVjaywgRSwgMiwgMCkpLCBkID0gaCA9IDBcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgYS5oZWFkICYmIChhLmhlYWQuZXh0cmEgPSBudWxsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBhLm1vZGUgPSA2O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA2OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxMDI0ICYgYS5mbGFncyAmJiAobyA8ICh1ID0gYS5sZW5ndGgpICYmICh1ID0gbyksIHUgJiYgKGEuaGVhZCAmJiAoeSA9IGEuaGVhZC5leHRyYV9sZW4gLSBhLmxlbmd0aCwgYS5oZWFkLmV4dHJhIHx8IChhLmhlYWQuZXh0cmEgPSBuZXcgQXJyYXkoYS5oZWFkLmV4dHJhX2xlbikpLCBaLmFycmF5U2V0KGEuaGVhZC5leHRyYSwgaSwgciwgdSwgeSkpLCA1MTIgJiBhLmZsYWdzICYmIChhLmNoZWNrID0gQyhhLmNoZWNrLCBpLCB1LCByKSksIG8gLT0gdSwgciArPSB1LCBhLmxlbmd0aCAtPSB1KSwgYS5sZW5ndGgpKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGEubGVuZ3RoID0gMCwgYS5tb2RlID0gNztcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNzpcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoMjA0OCAmIGEuZmxhZ3MpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG8pIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodSA9IDA7IHkgPSBpW3IgKyB1KytdLCBhLmhlYWQgJiYgeSAmJiBhLmxlbmd0aCA8IDY1NTM2ICYmIChhLmhlYWQubmFtZSArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHkpKSwgeSAmJiB1IDwgbzspO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoNTEyICYgYS5mbGFncyAmJiAoYS5jaGVjayA9IEMoYS5jaGVjaywgaSwgdSwgcikpLCBvIC09IHUsIHIgKz0gdSwgeSkgYnJlYWsgdFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBhLmhlYWQgJiYgKGEuaGVhZC5uYW1lID0gbnVsbCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYS5sZW5ndGggPSAwLCBhLm1vZGUgPSA4O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA4OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICg0MDk2ICYgYS5mbGFncykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gbykgYnJlYWsgdDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh1ID0gMDsgeSA9IGlbciArIHUrK10sIGEuaGVhZCAmJiB5ICYmIGEubGVuZ3RoIDwgNjU1MzYgJiYgKGEuaGVhZC5jb21tZW50ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoeSkpLCB5ICYmIHUgPCBvOyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg1MTIgJiBhLmZsYWdzICYmIChhLmNoZWNrID0gQyhhLmNoZWNrLCBpLCB1LCByKSksIG8gLT0gdSwgciArPSB1LCB5KSBicmVhayB0XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGEuaGVhZCAmJiAoYS5oZWFkLmNvbW1lbnQgPSBudWxsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBhLm1vZGUgPSA5O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA5OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICg1MTIgJiBhLmZsYWdzKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBkIDwgMTY7KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gbykgYnJlYWsgdDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8tLSwgaCArPSBpW3IrK10gPDwgZCwgZCArPSA4XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGggIT09ICg2NTUzNSAmIGEuY2hlY2spKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1zZyA9IFxcXCJoZWFkZXIgY3JjIG1pc21hdGNoXFxcIiwgYS5tb2RlID0gMzA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBoID0gMFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBhLmhlYWQgJiYgKGEuaGVhZC5oY3JjID0gYS5mbGFncyA+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/IGggOiBMKGgpKSAhPT0gYS5jaGVjaykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW5jb3JyZWN0IGRhdGEgY2hlY2tcXFwiLCBhLm1vZGUgPSAzMDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGggPSAwXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGEubW9kZSA9IDI4O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyODpcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS53cmFwICYmIGEuZmxhZ3MpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGQgPCAzMjspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBvKSBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby0tLCBoICs9IGlbcisrXSA8PCBkLCBkICs9IDhcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCAhPT0gKDQyOTQ5NjcyOTUgJiBhLnRvdGFsKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tc2cgPSBcXFwiaW5jb3JyZWN0IGxlbmd0aCBjaGVja1xcXCIsIGEubW9kZSA9IDMwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gaCA9IDBcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYS5tb2RlID0gMjk7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDI5OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIHggPSAxO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHQ7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDMwOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIHggPSAtMztcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0O1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAzMTpcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTQ7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIDMyOlxcbiAgICAgICAgICAgICAgICAgICAgZGVmYXV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CBfLCB1LCBjLCBiLCBnLCBtID0gby5iaXRzLFxcbiAgICAgICAgICAgICAgICAgICAgdyA9IDAsXFxuICAgICAgICAgICAgICAgICAgICBwID0gMCxcXG4gICAgICAgICAgICAgICAgICAgIHYgPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgayA9IDAsXFxuICAgICAgICAgICAgICAgICAgICB5ID0gMCxcXG4gICAgICAgICAgICAgICAgICAgIHggPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgeiA9IDAsXFxuICAgICAgICAgICAgICAgICAgICBCID0gMCxcXG4gICAgICAgICAgICAgICAgICAgIFMgPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgRSA9IDAsXFxuICAgICAgICAgICAgICAgICAgICBBID0gbnVsbCxcXG4gICAgICAgICAgICAgICAgICAgIFogPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgUiA9IG5ldyBELkJ1ZjE2KDE2KSxcXG4gICAgICAgICAgICAgICAgICAgIEMgPSBuZXcgRC5CdWYxNigxNiksXFxuICAgICAgICAgICAgICAgICAgICBOID0gbnVsbCxcXG4gICAgICAgICAgICAgICAgICAgIE8gPSAwO1xcbiAgICAgICAgICAgICAgICBmb3IgKHcgPSAwOyB3IDw9IDE1OyB3KyspIFJbd10gPSAwO1xcbiAgICAgICAgICAgICAgICBmb3IgKHAgPSAwOyBwIDwgaTsgcCsrKSBSW2VbYSArIHBdXSsrO1xcbiAgICAgICAgICAgICAgICBmb3IgKHkgPSBtLCBrID0gMTU7IDEgPD0gayAmJiAwID09PSBSW2tdOyBrLS0pO1xcbiAgICAgICAgICAgICAgICBpZiAoayA8IHkgJiYgKHkgPSBrKSwgMCA9PT0gaykgcmV0dXJuIG5bcisrXSA9IDIwOTcxNTIwLCBuW3IrK10gPSAyMDk3MTUyMCwgby5iaXRzID0gMSwgMDtcXG4gICAgICAgICAgICAgICAgZm9yICh2ID0gMTsgdiA8IGsgJiYgMCA9PT0gUlt2XTsgdisrKTtcXG4gICAgICAgICAgICAg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ZyB8IDAsIDAgIT09IGg7KTtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAobCA9IDEgPDwgdyAtIDE7IEUgJiBsOykgbCA+Pj0gMTtcXG4gICAgICAgICAgICAgICAgICAgIGlmICgwICE9PSBsID8gKEUgJj0gbCAtIDEsIEUgKz0gbCkgOiBFID0gMCwgcCsrLCAwID09IC0tUlt3XSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3ID09PSBrKSBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICB3ID0gZVthICsgc1twXV1cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGlmICh5IDwgdyAmJiAoRSAmIGYpICE9PSBkKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yICgwID09PSB6ICYmICh6ID0geSksIF8gKz0gdiwgQiA9IDEgPDwgKHggPSB3IC0geik7IHggKyB6IDwgayAmJiAhKChCIC09IFJbeCArIHpdKSA8PSAwKTspIHgrKywgQiA8PD0gMTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoUyArPSAxIDw8IHgsIDEgPT09IHQgJiYgODUyIDwgUyB8fCAyID09PSB0ICYmIDU5MiA8IFMpIHJldHVybiAxO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIG5bZCA9IEUgJiBmXSA9IHkgPDwgMjQgfCB4IDw8IDE2IHwgXyAtIHIgfCAwXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIDAgIT09IEUgJiYgKG5bXyArIEVdID0gdyAtIHogPDwgMjQgfCA2NCA8PCAxNiB8IDApLCBvLmJpdHMgPSB5LCAwXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgIFxcXCIuLi91dGlscy9jb21tb25cXFwiOiAzXFxuICAgICAgICB9XSxcXG4gICAgICAgIDEzOiBbZnVuY3Rpb24odCwgZSwgYSkge1xcbiAgICAgICAgICAgIFxcXCJ1c2Ugc3RyaWN0XFxcIjtcXG4gICAgICAgICAgICBlLmV4cG9ydHMgPSB7XFxuICAgICAgICAgICAgICAgIDI6IFxcXCJuZWVkIGRpY3Rpb25hcnlcXFwiLFxcbiAgICAgICAgICAgICAgICAxOiBcXFwic3RyZWFtIGVuZFxcXCIsXFxuICAgICAgICAgICAgICAgIDA6IFxcXCJcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwiLTFcXFwiOiBcXFwiZmlsZSBlcnJvclxcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCItMlxcXCI6IFxcXCJzdHJlYW0gZXJyb3JcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwiLTNcXFwiOiBcXFwiZGF0YSBlcnJvclxcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCItNFxcXCI6IFxcXCJpbnN1ZmZpY2llbnQgbWVtb3J5XFxcIixcXG4gICAgICAgICAgICAgICAgXFxcIi01XFxcIjogXFxcImJ1ZmZlciBlcnJvclxcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCItNlxcXCI6IFxcXCJpbmNvbXBhdGlibGUgdmVyc2lvblxcXCJcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCB7fV0sXFxuICAgICAgICAxNDogW2Z1bmN0aW9uKHQsIGUsIGEpIHtcXG4gICAgICAgICAgICBcXFwidXNlIHN0cmljdFxcXCI7XFxuICAgICAgICAgICAgdmFyIGwgPSB0KFxcXCIuLi91dGlscy9jb21tb25cXFwiKSxcXG4gICAgICAgICAgICAgICAgbyA9IDAsXFxuICAgICAgICAgICAgICAgIGggPSAxO1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGkodCkge1xcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gdC5sZW5ndGg7IDAgPD0gLS1lOykgdFtlXSA9IDBcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdmFyIGQgPSAwLFxcbiAgICAgICAgICAgICAgICBzID0gMjksXFxuICAgICAgICAgICAgICAgIGYgPSAyNTYsXFxuICAgICAgICAgICAgICAgIF8gPSBmICsgMSArIHMsXFxuICAgICAgICAgICAgICAgIHUgPSAzMCxcXG4gICAgICAgICAgICAgICAgYyA9IDE5LFxcbiAgICAgICAgICAgICAgICBnID0gMiAqIF8gKyAxLFxcbiAgICAgICAgICAgICAgICBtID0gMTUsXFxuICAgICAgICAgICAgICAgIG4gPSAxNixcXG4gICAgICAgICAgICAgICAgYiA9IDcsXFxuICAgICAgICAgICAgICAgIHcgPSAyNTYsXFxuICAgICAgICAgICAgICAgIHAgPSAxNixcXG4gICAgICAgICAgICAgICAgdiA9IDE3LFxcbiAgICAgICAgICAgICAgICBrID0gMTgsXFxuICAgICAgICAgICAgICAgIHkgPSBbMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMSwgMSwgMSwgMSwgMiwgMiwgMiwgMiwgMywgMywgMywgMywgNCwgNCwgNCwgNCwgNSwgNSwgNSwgNSwgMF0sXFxuICAgICAgICAgICAgICAgIHggPSBbMCwgMCwgMCwgMCwgMSwgMSwgMiwgMiwgMywgMywgNCwgNCwgNSwgNSwgNiwgNiwgNywgNywgOCwgOCwgOSwgOSwgMTAsIDEwLCAxMSwgMTEsIDEyLCAxMiwgMTMsIDEzXSxcXG4gICAgICAgICAgICAgICAgeiA9IFswLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAyLCAzLCA3XSxcXG4gICAgICAgICAgICAgICAgQiA9IFsxNiwgMTcsIDE4LCAwLCA4LCA3LCA5LCA2LCAxMCwgNSwgMTEsIDQsIDEyLCAzLCAxMywgMiwgMTQsIDEsIDE1XSxcXG4gICAgICAgICAgICAgICAgUyA9IG5ldyBBcnJheSgyICogKF8gKyAyKSk7XFxuICAgICAgICAgICAgaShTKTtcXG4gICAgICAgICAgICB2YXIgRSA9IG5ldyBBcnJheSgyICogdSk7XFxuICAgICAgICAgICAgaShFKTtcXG4gICAgICAgICAgICB2YXIgQSA9IG5ldyBBcnJheSg1MTIpO1xcbiAgICAgICAgICAgIGkoQSk7XFxuICAgICAgICAgICAgdmFyIFogPSBuZXcgQXJyYXkoMjU2KTtcXG4gICAgICAgICAgICBpKFopO1xcbiAgICAgICAgICAgIHZhciBSID0gbmV3IEFycmF5KHMpO1xcbiAgICAgICAgICAgIGkoUik7XFxuICAgICAgICAgICAgdmFyIEMsIE4sIE8sIEQgPSBuZXcgQXJyYXkodSk7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gSSh0LCBlLCBhLCBpLCBuKSB7XFxuICAgICAgICAgICAgICAgIHRoaXMuc3RhdGljX3RyZWUgPSB0LCB0aGlzLmV4dHJhX2JpdHMgPSBlLCB0aGlzLmV4dHJhX2Jhc2UgPSBhLCB0aGlzLmVsZW1zID0gaSwgdGhpcy5tYXhfbGVuZ3RoID0gbiwgdGhpcy5oYXNfc3RyZWUgPSB0ICYmIHQubGVuZ3RoXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIHIodCwgZSkge1xcbiAgICAgICAgICAgICAgICB0aGlzLmR5bl90cmVlID0gdCwgdGhpcy5tYXhfY29kZSA9IDAsIHRoaXMuc3RhdF9kZXNjID0gZVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBVKHQpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHQgPCAyNTYgPyBBW3RdIDogQVsyNTYgKyAodCA+Pj4gNyldXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIFQodCwgZSkge1xcbiAgICAgICAgICAgICAgICB0LnBlbmRpbmdfYnVmW3QucGVuZGluZysrXSA9IDI1NSAmIGUsIHQucGVuZGluZ19idWZbdC5wZW5kaW5nKytdID0gZSA+Pj4gOCAmIDI1NVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBGKHQsIGUsIGEpIHtcXG4gICAgICAgICAgICAgICAgdC5iaV92YWxpZCA+IG4gLSBhID8gKHQuYmlfYnVmIHw9IGUgPDwgdC5iaV92YWxpZCAmIDY1NTM1LCBUKHQsIHQuYmlfYnVmKSwgdC5iaV9idWYgPSBlID4+IG4gLSB0LmJpX3ZhbGlkLCB0LmJpX3ZhbGlkICs9IGEgLSBuKSA6ICh0LmJpX2J1ZiB8PSBlIDw8IHQuYmlfdmFsaWQgJiA2NTUzNSwgdC5iaV92YWxpZCArPSBhKVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBMKHQsIGUsIGEpIHtcXG4gICAgICAgICAgICAgICAgRih0LCBhWzIgKiBlXSwgYVsyICogZSArIDFdKVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBIKHQsIGUpIHtcXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IDA7IGEgfD0gMSAmIHQsIHQgPj4+PSAxLCBhIDw8PSAxLCAwIDwgLS1lOyk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBhID4+PiAxXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGoodCwgZSwgYSkge1xcbiAgICAgICAgICAgICAgICB2YXIgaSwgbiwgciA9IG5ldyBBcnJheShtICsgMSksXFxuICAgICAgICAgICAgICAgICAgICBzID0gMDtcXG4gICAgICAgICAgICAgICAgZm9yIChpID0gMTsgaSA8PSBtOyBpKyspIHJbaV0gPSBzID0gcyArIGFbaSAtIDFdIDw8IDE7XFxuICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPD0gZTsgbisrKSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRbMiAqIG4gKyAxXTtcXG4gICAgICAgICAgICAgICAgICAgIDAgIT09IG8gJiYgKHRbMiAqIG5dID0gSChyW29dKyssIG8pKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIEsodCkge1xcbiAgICAgICAgICAgICAgICB2YXIgZTtcXG4gICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IF87IGUrKykgdC5keW5fbHRyZWVbMiAqIGVdID0gMDtcXG4gICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IHU7IGUrKykgdC5keW5fZHRyZWVbMiAqIGVdID0gMDtcXG4gICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IGM7IGUrKykgdC5ibF90cmVlWzIgKiBlXSA9IDA7XFxuICAgICAgICAgICAgICAgIHQuZHluX2x0cmVlWzIgKiB3XSA9IDEsIHQub3B0X2xlbiA9IHQuc3RhdGljX2xlbiA9IDAsIHQubGFzdF9saXQgPSB0Lm1hdGNoZXMgPSAwXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIE0odCkge1xcbiAgICAgICAgICAgICAgICA4IDwgdC5iaV92YWxpZCA/IFQodCwgdC5iaV9idWYpIDogMCA8IHQuYmlfdmFsaWQgJiYgKHQucGVuZGluZ19idWZbdC5wZW5kaW5nKytdID0gdC5iaV9idWYpLCB0LmJpX2J1ZiA9IDAsIHQuYmlfdmFsaWQgPSAwXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIFAodCwgZSwgYSwgaSkge1xcbiAgICAgICAgICAgICAgICB2YXIgbiA9IDIgKiBlLFxcbiAgICAgICAgICAgICAgICAgICAgciA9IDIgKiBhO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdFtuXSA8IHRbcl0gfHwgdFtuXSA9PT0gdFtyXSAmJiBpW2VdIDw9IGlbYV1cXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gWSh0LCBlLCBhKSB7XFxuICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSB0LmhlYXBbYV0sIG4gPSBhIDw8IDE7IG4gPD0gdC5oZWFwX2xlbiAmJiAobiA8IHQuaGVhcF9sZW4gJiYgUChlLCB0LmhlYXBbbiArIDFdLCB0LmhlYXBbbl0sIHQuZGVwdGgpICYmIG4rKywgIVAoZSwgaSwgdC5oZWFwW25dLCB0LmRlcHRoKSk7KSB0LmhlYXBbYV0gPSB0LmhlYXBbbl0sIGEgPSBuLCBuIDw8PSAxO1xcbiAgICAgICAgICAgICAgICB0LmhlYXBbYV0gPSBpXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIHEodCwgZSwgYSkge1xcbiAgICAgICAgICAgICAgICB2YXIgaSwgbiwgciwgcywgbyA9IDA7XFxuICAgICAgICAgICAgICAgIGlmICgwICE9PSB0Lmxhc3RfbGl0KVxcbiAgICAgICAgICAgICAgICAgICAgZm9yICg7IGkgPSB0LnBlbmRpbmdfYnVmW3QuZF9idWYgKyAyICogb10gPDwgOCB8IHQucGVuZGluZ19idWZbdC5kX2J1ZiArIDIgKiBvICsgMV0sIG4gPSB0LnBlbmRpbmdfYnVmW3QubF9idWYgKyBvXSwgbysrLCAwID09PSBpID8gTCh0LCBuLCBlKSA6IChMKHQsIChyID0gWltuXSkgKyBmICsgMSwgZSksIDAgIT09IChzID0geVtyXSkgJiYgRih0LCBuIC09IFJbcl0sIHMpLCBMKHQsIHIgPSBVKC0taSksIGEpLCAwICE9PSAocyA9IHhbcl0pICYmIEYodCwgaSAtPSBEW3JdLCBzKSksIG8gPCB0Lmxhc3RfbGl0Oyk7XFxuICAgICAgICAgICAgICAgIEwodCwgdywgZSlcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gRyh0LCBlKSB7XFxuICAgICAgICAgICAgICAgIHZhciBhLCBpLCBuLCByID0gZS5keW5fdHJlZSxcXG4gICAgICAgICAgICAgICAgICAgIHMgPSBlLnN0YXRfZGVzYy5zdGF0aWNfdHJlZSxcXG4gICAgICAgICAgICAgICAgIC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B0LmhlYXBfbGVuOyk7XFxuICAgICAgICAgICAgICAgIHQuaGVhcFstLXQuaGVhcF9tYXhdID0gdC5oZWFwWzFdLFxcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24odCwgZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCBpLCBuLCByLCBzLCBvLCBsID0gZS5keW5fdHJlZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IGUubWF4X2NvZGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBlLnN0YXRfZGVzYy5zdGF0aWNfdHJlZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGUuc3RhdF9kZXNjLmhhc19zdHJlZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXyA9IGUuc3RhdF9kZXNjLmV4dHJhX2JpdHMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBlLnN0YXRfZGVzYy5leHRyYV9iYXNlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gZS5zdGF0X2Rlc2MubWF4X2xlbmd0aCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IDA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyID0gMDsgciA8PSBtOyByKyspIHQuYmxfY291bnRbcl0gPSAwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobFsyICogdC5oZWFwW3QuaGVhcF9tYXhdICsgMV0gPSAwLCBhID0gdC5oZWFwX21heCArIDE7IGEgPCBnOyBhKyspIGMgPCAociA9IGxbMiAqIGxbMiAqIChpID0gdC5oZWFwW2FdKSArIDFdICsgMV0gKyAxKSAmJiAociA9IGMsIGIrKyksIGxbMiAqIGkgKyAxXSA9IHIsIGggPCBpIHx8ICh0LmJsX2NvdW50W3JdKyssIHMgPSAwLCB1IDw9IGkgJiYgKHMgPSBfW2kgLSB1XSksIG8gPSBsWzIgKiBpXSwgdC5vcHRfbGVuICs9IG8gKiAociArIHMpLCBmICYmICh0LnN0YXRpY19sZW4gKz0gbyAqIChkWzIgKiBpICsgMV0gKyBzKSkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwICE9PSBiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociA9IGMgLSAxOyAwID09PSB0LmJsX2NvdW50W3JdOykgci0tO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ibF9jb3VudFtyXS0tLCB0LmJsX2NvdW50W3IgKyAxXSArPSAyLCB0LmJsX2NvdW50W2NdLS0sIGIgLT0gMlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgwIDwgYik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociA9IGM7IDAgIT09IHI7IHItLSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IHQuYmxfY291bnRbcl07IDAgIT09IGk7KSBoIDwgKG4gPSB0LmhlYXBbLS1hXSkgfHwgKGxbMiAqIG4gKyAxXSAhPT0gciAmJiAodC5vcHRfbGVuICs9IChyIC0gbFsyICogbiArIDFdKSAqIGxbMiAqIG5dLCBsWzIgKiBuICsgMV0gPSByKSwgaS0tKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0odCwgZSksIGoociwgaCwgdC5ibF9jb3VudClcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gWCh0LCBlLCBhKSB7XFxuICAgICAgICAgICAgICAgIHZhciBpLCBuLCByID0gLTEsXFxuICAgICAgICAgICAgICAgICAgICBzID0gZVsxXSxcXG4gICAgICAgICAgICAgICAgICAgIG8gPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgbCA9IDcsXFxuICAgICAgICAgICAgICAgICAgICBoID0gNDtcXG4gICAgICAgICAgICAgICAgZm9yICgwID09PSBzICYmIChsID0gMTM4LCBoID0gMyksIGVbMiAqIChhICsgMSkgKyAxXSA9IDY1NTM1LCBpID0gMDsgaSA8PSBhOyBpKyspIG4gPSBzLCBzID0gZVsyICogKGkgKyAxKSArIDFdLCArK28gPCBsICYmIG4gPT09IHMgfHwgKG8gPCBoID8gdC5ibF90cmVlWzIgKiBuXSArPSBvIDogMCAhPT0gbiA/IChuICE9PSByICYmIHQuYmxfdHJlZVsyICogbl0rKywgdC5ibF90cmVlWzIgKiBwXSsrKSA6IG8gPD0gMTAgPyB0LmJsX3RyZWVbMiAqIHZdKysgOiB0LmJsX3RyZWVbMiAqIGtdKyssIHIgPSBuLCAobyA9IDApID09PSBzID8gKGwgPSAxMzgsIGggPSAzKSA6IG4gPT09IHMgPyAobCA9IDYsIGggPSAzKSA6IChsID0gNywgaCA9IDQpKVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBXKHQsIGUsIGEpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGksIG4sIHIgPSAtMSxcXG4gICAgICAgICAgICAgICAgICAgIHMgPSBlWzFdLFxcbiAgICAgICAgICAgICAgICAgICAgbyA9IDAsXFxuICAgICAgICAgICAgICAgICAgICBsID0gNyxcXG4gICAgICAgICAgICAgICAgICAgIGggPSA0O1xcbiAgICAgICAgICAgICAgICBmb3IgKDAgPT09IHMgJiYgKGwgPSAxMzgsIGggPSAzKSwgaSA9IDA7IGkgPD0gYTsgaSsrKVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSBzLCBzID0gZVsyICogKGkgKyAxKSArIDFdLCAhKCsrbyA8IGwgJiYgbiA9PT0gcykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobyA8IGgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBMKHQsIG4sIHQuYmxfdHJlZSksIDAgIT0gLS1vOyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSAwICE9PSBuID8gKG4gIT09IHIgJiYgKEwodCwgbiwgdC5ibF90cmVlKSwgby0tKSwgTCh0LCBwLCB0LmJsX3RyZWUpLCBGKHQsIG8gLSAzLCAyKSkgOiBvIDw9IDEwID8gKEwodCwgdiwgdC5ibF90cmVlKSwgRih0LCBvIC0gMywgMykpIDogKEwodCwgaywgdC5ibF90cmVlKSwgRih0LCBvIC0gMTEsIDcpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByID0gbiwgKG8gPSAwKSA9PT0gcyA/IChsID0gMTM4LCBoID0gMykgOiBuID09PSBzID8gKGwgPSA2LCBoID0gMykgOiAobCA9IDcsIGggPSA0KVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpKEQpO1xcbiAgICAgICAgICAgIHZhciBKID0gITE7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gUSh0LCBlLCBhLCBpKSB7XFxuICAgICAgICAgICAgICAgIHZhciBuLCByLCBzLCBvO1xcbiAgICAgICAgICAgICAgICBGKHQsIChkIDw8IDEpICsgKGkgPyAxIDogMCksIDMpLCByID0gZSwgcyA9IGEsIG8gPSAhMCwgTShuID0gdCksIG8gJiYgKFQobiwgcyksIFQobiwgfnMpKSwgbC5hcnJheVNldChuLnBlbmRpbmdfYnVmLCBuLndpbmRvdywgciwgcywgbi5wZW5kaW5nKSwgbi5wZW5kaW5nICs9IHNcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYS5fdHJfaW5pdCA9IGZ1bmN0aW9uKHQpIHtcXG4gICAgICAgICAgICAgICAgSiB8fCAoZnVuY3Rpb24oKSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgdCwgZSwgYSwgaSwgbiwgciA9IG5ldyBBcnJheShtICsgMSk7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSBhID0gMDsgaSA8IHMgLSAxOyBpKyspXFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChSW2ldID0gYSwgdCA9IDA7IHQgPCAxIDw8IHlbaV07IHQrKykgWlthKytdID0gaTtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoWlthIC0gMV0gPSBpLCBpID0gbiA9IDA7IGkgPCAxNjsgaSsrKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoRFtpXSA9IG4sIHQgPSAwOyB0IDwgMSA8PCB4W2ldOyB0KyspIEFbbisrXSA9IGk7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPj49IDc7IGkgPCB1OyBpKyspXFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChEW2ldID0gbiA8PCA3LCB0ID0gMDsgdCA8IDEgPDwgeFtpXSAtIDc7IHQrKykgQVsyNTYgKyBuKytdID0gaTtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IDA7IGUgPD0gbTsgZSsrKSByW2VdID0gMDtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAodCA9IDA7IHQgPD0gMTQzOykgU1syICogdCArIDFdID0gOCwgdCsrLCByWzhdKys7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKDsgdCA8PSAyNTU7KSBTWzIgKiB0ICsgMV0gPSA5LCB0KyssIHJbOV0rKztcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoOyB0IDw9IDI3OTspIFNbMiAqIHQgKyAxXSA9IDcsIHQrKywgcls3XSsrO1xcbiAgICAgICAgICAgICAgICAgICAgZm9yICg7IHQgPD0gMjg3OykgU1syICogdCArIDFdID0gOCwgdCsrLCByWzhdKys7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGooUywgXyArIDEsIHIpLCB0ID0gMDsgdCA8IHU7IHQrKykgRVsyICogdCArIDFdID0gNSwgRVsyICogdF0gPSBIKHQsIDUpO1xcbiAgICAgICAgICAgICAgICAgICAgQyA9IG5ldyBJKFMsIHksIGYgKyAxLCBfLCBtKSwgTiA9IG5ldyBJKEUsIHgsIDAsIHUsIG0pLCBPID0gbmV3IEkobmV3IEFycmF5KDApLCB6LCAwLCBjLCBiKVxcbiAgICAgICAgICAgICAgICB9KCksIEogPSAhMCksIHQubF9kZXNjID0gbmV3IHIodC5keW5fbHRyZWUsIEMpLCB0LmRfZGVzYyA9IG5ldyByKHQuZHluX2R0cmVlLCBOKSwgdC5ibF9kZXNjID0gbmV3IHIodC5ibF90cmVlLCBPKSwgdC5iaV9idWYgPSAwLCB0LmJpX3ZhbGlkID0gMCwgSyh0KVxcbiAgICAgICAgICAgIH0sIGEuX3RyX3N0b3JlZF9ibG9jayA9IFEsIGEuX3RyX2ZsdXNoX2Jsb2NrID0gZnVuY3Rpb24odCwgZSwgYSwgaSkge1xcbiAgICAgICAgICAgICAgICB2YXIgbiwgciwgcyA9IDA7XFxuICAgICAgICAgICAgICAgIDAgPCB0LmxldmVsID8gKDIgPT09IHQuc3RybS5kYXRhX3R5cGUgJiYgKHQuc3RybS5kYXRhX3R5cGUgPSBmdW5jdGlvbih0KSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgZSwgYSA9IDQwOTM2MjQ0NDc7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSAwOyBlIDw9IDMxOyBlKyssIGEgPj4+PSAxKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxICYgYSAmJiAwICE9PSB0LmR5bl9sdHJlZVsyICogZV0pIHJldHVybiBvO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09IHQuZHluX2x0cmVlWzE4XSB8fCAwICE9PSB0LmR5bl9sdHJlZVsyMF0gfHwgMCAhPT0gdC5keW5fbHRyZWVbMjZdKSByZXR1cm4gaDtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IDMyOyBlIDwgZjsgZSsrKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwICE9PSB0LmR5bl9sdHJlZVsyICogZV0pIHJldHVybiBoO1xcbiAgICAgICAgICAgICA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sX3R5cGU6IFxcXCJ0ZXh0XzJcXFwiXFxufSk7XFxuXFxuZnVuY3Rpb24gc2VhcmNoKGQsIG5hbWUpIHtcXG4gICAgY29uc3QgZGFubXUgPSAkLnJlcXVpcmUoXFxcImRhbm11XFxcIik7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVcXFwiXFxuICAgIH0pO1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lXFxcIlxcbiAgICB9KTtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCJcXG4gICAgfSk7XFxuICAgIGxldCBkbUxpc3QgPSBkYW5tdS5nZXREYW5NdShuYW1lKTtcXG5cXG4gICAgZm9yIChsZXQgYW5pbWUgb2YgZG1MaXN0LmFuaW1lcykge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogYW5pbWUuYW5pbWVUaXRsZSxcXG4gICAgICAgICAgICBkZXNjOiBhbmltZS50eXBlRGVzY3JpcHRpb24sXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJhdmF0YXJcXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgIHBpY191cmw6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vdHViaWFvL21vdmllLzE0LnN2Z1xcXCJcXG4gICAgICAgIH0pO1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVcXFwiXFxuICAgICAgICB9KTtcXG4gICAgICAgIGZvciAobGV0IGVwaXNvZGUgb2YgYW5pbWUuZXBpc29kZXMpIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogZXBpc29kZS5lcGlzb2RlVGl0bGUsXFxuICAgICAgICAgICAgICAgIHVybDogJChlcGlzb2RlLmVwaXNvZGVJZCkubGF6eVJ1bGUoKHVybCwgdGl0bGUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGRhbm11ID0gJC5yZXF1aXJlKFxcXCJkYW5tdVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHBhdGggPSBkYW5tdS5nZXRMb2NhbERhbk11KGlucHV0LCB0aXRsZSkgfHwgZGFubXUuZG93bmxvYWREYW5NdShpbnB1dCwgdGl0bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRhbm11VGV4dCA9IGZldGNoKHBhdGgpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFkYW5tdVRleHQpIHJldHVybiBcXFwidG9hc3Q6Ly/ov5jmsqHmnInlvLnluZXlk59+XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hWaWRlb1VybCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZGFubXU6IHBhdGhcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgcHV0VmFyKFxcXCJkbV9zaGFyZVxcXCIscGF0aCk7XFxuICAgICAgICAgICAgICAgICAgICBiYWNrKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/liqDovb3lrozmiJBcXFwiO1xcbiAgICAgICAgICAgICAgICB9LCBNWV9QQVJBTVMuZHVybCwgYW5pbWUuYW5pbWVUaXRsZSArIFxcXCJfXFxcIiArIGVwaXNvZGUuZXBpc29kZVRpdGxlKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzFcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5by65Yi25LiL6L29XFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoZXBpc29kZVRpdGxlLCBlcGlzb2RlSWQpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvd0xvYWRpbmcoXFxcIuivt+etieW+hVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBkYW5tdSA9ICQucmVxdWlyZShcXFwiZGFubXVcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGFubXUuZG93bmxvYWREYW5NdShlcGlzb2RlSWQsIGVwaXNvZGVUaXRsZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhpZGVMb2FkaW5nKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/ph43mlrDkuIvovb3lrozmiJDvvIzljZXlh7vmjILovb3jgIJcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGFuaW1lLmFuaW1lVGl0bGUgKyBcXFwiX1xcXCIgK2VwaXNvZGUuZXBpc29kZVRpdGxlLCBlcGlzb2RlLmVwaXNvZGVJZClcXG4gICAgICAgICAgICAgICAgICAgIH1dXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lX2JsYW5rXFxcIlxcbiAgICAgICAgfSk7XFxuICAgIH1cXG4gICAgaWYgKCFkbUxpc3QuYW5pbWVzLmxlbmd0aCkge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuayoeacieaJvuWIsOS4jltcXFwiICsgbmFtZSArIFxcXCJd55u45YWz55qE5by55bmVXFxcIixcXG4gICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICBkZXNjOiBcXFwi5pCc5LiN5Yiw5oCO5L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pa2VyOi8vcGFnZS9hcGlcXFwiKS5iaWxpTGF6eShhaWQsIGNpZCwgMTE2KS5yZXBsYWNlKC87L2csIFxcXCLvvJvvvJtcXFwiKTtcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgfSBlbHNlIHtcXHJcXG4gICAgICAgIC8vIOaZrumAmueUqOaIt1xcclxcbiAgICAgICAgaWYgKGdldE15VmFyKCdiZl9jb29raWUnLCfmnKrlrprkuYknKT09J+acquWumuS5iScpIHtcXHJcXG4gICAgICAgICAgICBpZiAoYmFkZ2UubWF0Y2goL+S8muWRmHzku5jotLkvKSkge1xcclxcbiAgICAgICAgICAgICAgICBldmFsKGZldGNoKCdoaWtlcjovL2ZpbGVzL2NhY2hlL1BhcnNlX0RuLmpzJywge30pKTtcXHJcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGF5dG1QYXJzZShpbnB1dCk7XFxyXFxuICAgICAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2FwaVxcXCIpLmJpbGlMYXp5KGFpZCwgY2lkLCAxMTYpLnJlcGxhY2UoLzsvZywgXFxcIu+8m++8m1xcXCIpO1xcclxcbiAgICAgICAgICAgIH0gIFxcclxcbiAgICAgICAgfWVsc2V7XFxyXFxuICAgICAgICAgICAgLy8g5YWx5Lqr5Lya5ZGY5p2D6ZmQXFxyXFxuICAgICAgICAgICAgaWYgKGJhZGdlLm1hdGNoKC/ku5jotLkvKSkge1xcclxcbiAgICAgICAgICAgICAgICByZXR1cm4gJChbJ+mtlOaWreino+aekCcsJ+W3sui0reS5sCddLCAxKS5zZWxlY3QoKGlucHV0LGFpZCxjaWQpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dD09J+mtlOaWreino+aekCcpIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKGZldGNoKCdoaWtlcjovL2ZpbGVzL2NhY2hlL1BhcnNlX0RuLmpzJywge30pKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXl0bVBhcnNlKGxpbmspO1xcclxcbiAgICAgICAgICAgICAgICAgICAgfWVsc2V7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2FwaVxcXCIpLmJpbGlMYXp5KGFpZCwgY2lkLCAxMTYpLnJlcGxhY2UoLzsvZywgXFxcIu+8m++8m1xcXCIpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICB9LGxpbmssYWlkLGNpZClcXHJcXG4gICAgICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgICAgICByZXR1cm4gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvYXBpXFxcIikuYmlsaUxhenkoYWlkLCBjaWQsIDExNikucmVwbGFjZSgvOy9nLCBcXFwi77yb77ybXFxcIik7XFxyXFxuICAgICAgICAgICAgfVxcclxcbiAgICAgICAgfVxcclxcbiAgICB9XFxyXFxufSk7XFxyXFxudmFyIENvbG9yID0gXFxcIiMxOUI4OURcXFwiO1xcclxcbnZhciDmr4/pobXpm4bmlbAgPSAzMDtcXHJcXG52YXIg5pCc57Si5qih5byPID0gJ+WIhue7hCc7XFxyXFxudmFyIOiwg+eUqOWQjeensCA9ICfnroDlvbEnO1xcclxcbnB1dE15VmFyKCfmipjlj6AnLCAn5YWzJyk7XFxyXFxucHV0TXlWYXIoJ+aXpeWOhicsICflhbMnKTtcXHJcXG5wdXRNeVZhcignRGF0YScsIERhdGEpO1xcclxcbnB1dE15VmFyKCdsYXp5JywgbGF6eSk7XFxyXFxuLy8g5riF6Zmk5Y+Y6YePXFxyXFxuYWRkTGlzdGVuZXIoJ29uQ2xvc2UnLCAkLnRvU3RyaW5nKCgpID0+IHtcXHJcXG4gICAgY2xlYXJNeVZhcign5YiG6ZuG6LW3J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gICAgICAgICAgICBjb2xfdHlwZTogJ2xvbmdfdGV4dCdcXHJcXG4gICAgICAgIH0pO1xcclxcbiAgICAgICAgcmVzLmRhdGEgPSBkO1xcclxcbiAgICAgICAgc2V0SG9tZVJlc3VsdChyZXMpO1xcclxcbiAgICB9LCDnroDku4spLFxcclxcbiAgICBjb2xfdHlwZTogJ21vdmllXzFfdmVydGljYWxfcGljX2JsdXInLFxcclxcbn0pO1xcclxcbi8vIOabtOaWsOaXpeWOhuaooeWdl1xcclxcbmQucHVzaCh7XFxyXFxuICAgIHRpdGxlOiAn5pel5Y6GJyxcXHJcXG4gICAgaW1nOiBcXFwiaGlrZXI6Ly9maWxlcy9ydWxlcy9jeS9iaWxpX3BpYy/ml6XljoYucG5nXFxcIixcXHJcXG4gICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKCjov73liafml6XljoYsIOabtOaWsOi/m+W6pikgPT4ge1xcclxcbiAgICAgICAgaWYgKGdldE15VmFyKCfml6XljoYnLCAn5YWzJykgPT0gJ+W8gCcpIHtcXHJcXG4gICAgICAgICAgICBkZWxldGVJdGVtKCfov73liafml6XljoYnKTtcXHJcXG4gICAgICAgICAgICBwdXRNeVZhcign5pel5Y6GJywgJ+WFsycpO1xcclxcbiAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoJ+aYvuekuuaooeW8jycsIHtcXHJcXG4gICAgICAgICAgICAgICAgdGl0bGU6IOi/veWJp+aXpeWOhi5tYXRjaCgv5a6M57uTfOacn+W+hS8pID8g6L+95Ymn5pel5Y6GIDog6L+95Ymn5pel5Y6GICsgJzxicj48Zm9udCBjb2xvcj1cXFwicmVkXFxcIj7mm7TmlrDoh7MnICsgKOabtOaWsOi/m+W6pi5tYXRjaCgvW1xcXFx1NGUwMC1cXFxcdTlmYTVdLykgPyDmm7TmlrDov5vluqYgOiAoJ+esrCcgKyAo5pu05paw6L+b5bqmID09ICcnID8gMCA6IOabtOaWsOi/m+W6pikgKyAn6K+dJykpICsgJzwvZm9udD4nLFxcclxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInJpY2hfdGV4dFxcXCIsXFxyXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBpZDogJ+i/veWJp+aXpeWOhidcXHJcXG4gICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgIH0pO1xcclxcbiAgICAgICAgICAgIHB1dE15VmFyKCfml6XljoYnLCAn5byAJyk7XFxyXFxuICAgICAgICB9XFxyXFxuICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bey5YiH5o2i5pel5Y6G5Li6OicgKyBnZXRNeVZhcign5pel5Y6GJywgJ+W8gCcpXFxyXFxuICAgIH0sIOi/veWJp+aXpeWOhiwg5pu05paw6L+b5bqmKSxcXHJcXG4gICAgY29sX3R5cGU6ICdpY29uXzUnXFxyXFxufSk7XFxyXFxuLy8g6K6i6ZiF5qih5Z2XXFxyXFxuZC5wdXNoKHtcXHJcXG4gICAgdGl0bGU6ICforqLpmIUnLFxcclxcbiAgICBpbWc6IFxcXCJoaWtlcjovL2ZpbGVzL3J1bGVzL2N5L2JpbGlfcGljL+iuoumYhS5wbmdcXFwiLFxcclxcbiAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKCkgPT4ge1xcclxcbiAgICAgICAgc2VsZWN0aW9uTGlzdCA9IFsn6K6i6ZiFJywgJ+WPlua2iOiuoumYhSddO1xcclxcbiAgICAgICAgcmV0dXJuICQoc2VsZWN0aW9uTGlzdCwgMikuc2VsZWN0KCgpID0+IHtcXHJcXG4gICAgICAgICAgICBzZWFzb25faWQgPSBKU09OLnBhcnNlKGdldE15VmFyKCdEYXRhJykpLnNlYXNvbl9pZDtcXHJcXG4gICAgICAgICAgICBpZiAoaW5wdXQgPT0gJ+iuoumYhScpIHtcXHJcXG4gICAgICAgICAgICAgICAgcmVzID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvYXBpXFxcIikuc3Vic2NyaWJlRmlsbShzZWFzb25faWQpO1xcclxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxyXFxuICAgICAgICAgICAgICAgIHJlcyA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2FwaVxcXCIpLmNhbmNlbFN1YnNjcmliZUZpbG0oc2Vhc29uX2lkKTtcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovLycgKyByZXM7XFxyXFxuICAgICAgICB9KTtcXHJcXG4gICAgfSksXFxyXFxuICAgIGNvbF90eXBlOiAnaWNvbl81J1xcclxcbn0pO1xcclxcbi8vIOivhOiuuuaooeWdl1xcclxcbmQucHVzaCh7XFxyXFxuICAgIHRpdGxlOiAn6K+E6K66JyxcXHJcXG4gICAgaW1nOiBcXFwiaGlrZXI6Ly9maWxlcy9ydWxlcy9jeS9iaWxpX3BpYy/mn6XnnIvor4TorroucG5nXFxcIixcXHJcXG4gICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKCgpID0+IHtcXHJcXG4gICAgICAgIHJldHVybiAkKCdoaWtlcjovL2VtcHR5JykucnVsZSgoKSA9PiB7XFxyXFxuICAgICAgICAgICAgdmFyIGQgPSBbXTtcXHJcXG4gICAgICAgICAgICBMaXN0ID0gSlNPTi5wYXJzZShnZXRNeVZhcignRGF0YScpKS5lcGlzb2RlcztcXHJcXG4gICAgICAgICAgICBMaXN0LmZvckVhY2goaXRlbSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxyXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5zaGFyZV9jb3B5ICsgJzxmb250IGNvbG9yPVxcXCIjMzNjY2NjXFxcIj5cXHTinq48L2ZvbnQ+JyxcXHJcXG4gICAgICAgICAgICAgICAgICAgIGltZzogaXRlbS5jb3ZlciArICdAUmVmZXJlcj0nLFxcclxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAnaGlrZXI6Ly9wYWdlL0NvbW1lbnRzP3A9ZnlwYWdlJyxcXHJcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYXZhdGFyXFxcIixcXHJcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcImlkXFxcIjogaXRlbS5haWQsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcInR5cGVcXFwiOiAxXFxyXFxuICAgICAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgIH0pO1xcclxcbiAgICAgICAgICAgIH0pO1xcclxcbiAgICAgICAgICAgIHNldFJlc3VsdChkKTtcXHJcXG4gICAgICAgIH0pO1xcclxcbiAgICB9KSxcXHJcXG4gICAgY29sX3R5cGU6ICdpY29uXzUnXFxyXFxufSk7XFxyXFxuXFxyXFxuLy8g57K+5b2p57un57ut5qih5Z2XXFxyXFxuZC5wdXNoKHtcXHJcXG4gICAgdGl0bGU6ICflkajovrknLFxcclxcbiAgICBpbWc6IFxcXCJoaWtlcjovL2ZpbGVzL3J1bGVzL2N5L2JpbGlfcGljL+WRqOi+uS5wbmdcXFwiLFxcclxcbiAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKCkgPT4ge1xcclxcbiAgICAgICAgRGF0YSA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoJ0RhdGEnKSk7XFxyXFxuICAgICAgICAvLyDmnInkupvmsqHmnInnm7TmjqXljrvmjonmh5LlvpflpITnkIZ+XFxyXFxuICAgICAgICBpZiAoRGF0YS5zZWN0aW9uKSB7XFxyXFxuICAgICAgICAgICAg5ZGo6L655pWw57uEID0gW1xcXCLwn4+377iP55u45YWz57O75YiXXFxcIiwgXFxcIvCfpKNQViboirHnta5cXFwiLCBcXFwi8J+NieerluWxj+S5n+eyvuW9qVxcXCIsIFxcXCLwn5Sl57K+5b2p5LqM5YibXFxcIl07XFxyXFxuICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgIOWRqOi+ueaVsOe7hCA9IFtcXFwi8J+Pt++4j+ebuOWFs+ezu+WIl1xcXCJdO1xcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAgLy8g5ZGo6L655pWw57uEID0gW1xcXCLwn4+377iP55u45YWz57O75YiXXFxcIiwgXFxcIvCfpKNQViboirHnta5cXFwiLCBcXFwi56uW5bGP5Lmf57K+5b2pXFxcIiwgXFxcIueyvuW9qeS6jOWIm1xcXCJdO1xcclxcbiAgICAgICAgcmV0dXJuICQo5ZGo6L655pWw57uELCAxLCAn4YOm57K+5b2p57un57utJykuc2VsZWN0KCgpID0+IHtcXHJcXG4gICAgICAgICAgICBEYXRhID0gSlNPTi5wYXJzZShnZXRNeVZhcignRGF0YScpKTtcXHJcXG4gICAgICAgICAgICBsYXp5ID0gZ2V0TXlWYXIoJ2xhenknKTtcXHJcXG4gICAgICAgICAgICBpZiAoaW5wdXQgPT09ICfwn4+377iP55u45YWz57O75YiXJykge1xcclxcbiAgICAgICAgICAgICAgICDns7vliJflkI3np7AgPSBEYXRhLnNlYXNvbl90aXRsZVxcclxcbiAgICAgICAgICAgICAgICDns7vliJfmlbDmja4gPSBEYXRhLnNlYXNvbnM7XFxyXFxuICAgICAgICAgICAgICAgIHJldHVybiAkKCkucnVsZSgo57O75YiX5pWw5o2uKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBkID0gW107XFxyXFxuICAgICAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoJ/Cfj7fvuI/nm7jlhbPns7vliJcnKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGlmICjns7vliJfmlbDmja4gPT0gW10gfHwg57O75YiX5pWw5o2uID09ICcnKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfigJjigJjigJnigJk8YmlnPjxmb250IGNvbG9yPVxcXCJyZWRcXFwiPuKtkOivpeW9seeJh+ayoeacieebuOWFs+ezu+WIl+WTpn7irZA8L2ZvbnQ+PC9iaWc+JyxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAndG9hc3Q6Ly/pg73msqHmnInvvIzvvIzkvaDngrnllaXlkYB+JyxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogJ+aVrOivt+acn+W+hX4nLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgICAgICDns7vliJfmlbDmja4uZm9yRWFjaChsaXN0ID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogbGlzdC5zZWFzb25fdGl0bGUsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltZzogKGxpc3QuaG9yaXpvbnRhbF9jb3Zlcl8xNjEwID09ICcnID8gKGxpc3QuaG9yaXpvbnRhbF9jb3Zlcl8xNjkgPT0gJycgPyBsaXN0LmNvdmVyIDogbGlzdC5ob3Jpem9udGFsX2NvdmVyXzE2OSkgOiBsaXN0Lmhvcml6b250YWxfY292ZXJfMTYxMCkgKyBcXFwiQFJlZmVyZXI9XFxcIixcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaGlrZXI6Ly9wYWdlL2ZpbG1lcmppI2ltbWVyc2l2ZVRoZW1lIycsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IGxpc3QubmV3X2VwLmluZGV4X3Nob3csXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnbW92aWVfMV9sZWZ0X3BpYycsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwiZXBfaWRcXFwiOiBsaXN0Lm5ld19lcC5pZFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHNldEhvbWVSZXN1bHQoZCk7XFxyXFxuICAgICAgICAgICAgICAgIH0sIOezu+WIl+aVsOaNrilcXHJcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSAn8J+ko1BWJuiKsee1ricpIHtcXHJcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIFBW5ZKM6Iqx57Wu5pWw5o2uID0gRGF0YS5zZWN0aW9uWzBdLmVwaXNvZGVzO1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoKS5ydWxlKChQVuWSjOiKsee1ruaVsOaNriwgbGF6eSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBbXTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoJ/CfpKNQViboirHnta4nKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoUFblkozoirHnta7mlbDmja4gPT0gW10gfHwgUFblkozoirHnta7mlbDmja4gPT0gJycpIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn4oCY4oCY4oCZ4oCZPGJpZz48Zm9udCBjb2xvcj1cXFwicmVkXFxcIj7irZDor6XlvbHniYcv6KeG6aKR5rKh5pyJ55u45YWzUFblkozoirHnta7lk6Z+4q2QPC9mb250PjwvYmlnPicsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICd0b2FzdDovL+mDveayoeacie+8jO+8jOS9oOeCueWVpeWRgH4nLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogJ+aVrOivt+acn+W+hX4nLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJ1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgUFblkozoirHnta7mlbDmja4uZm9yRWFjaChsaXN0ID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBsaXN0LnRpdGxlLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW1nOiBsaXN0LmNvdmVyICsgXFxcIkBSZWZlcmVyPVxcXCIsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGxpc3QubGluayArIGxhenksXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBsaXN0LnN1YnRpdGxlICsgJ1xcXFxuJyArIGxpc3QubG9uZ190aXRsZSxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnbW92aWVfMV9sZWZ0X3BpYycsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBsaXN0LmxpbmssXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWlkOiBsaXN0LmFpZCxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidmlkOiBsaXN0LmJ2aWQsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2lkOiBsaXN0LmNpZCxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYWRnZTogbGlzdC5iYWRnZVxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRIb21lUmVzdWx0KGQpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgfSwgUFblkozoirHnta7mlbDmja4sIGxhenkpXFxyXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/msqHmnInmlbDmja7lk6Z+J1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gJ/CfjYnnq5blsY/kuZ/nsr7lvaknKSB7XFxyXFxuICAgICAgICAgICAgICAgIHRyeSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICDnq5blsY/kuZ/nsr7lvanmlbDmja4gPSBEYXRhLnNlY3Rpb25bMV0uZXBpc29kZXM7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJCgpLnJ1bGUoKOerluWxj+S5n+eyvuW9qeaVsOaNriwgbGF6eSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBbXTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoJ/CfjYnnq5blsY/kuZ/nsr7lvaknKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAo56uW5bGP5Lmf57K+5b2p5pWw5o2uID09IFtdIHx8IOerluWxj+S5n+eyvuW9qeaVsOaNriA9PSAnJykge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfigJjigJjigJnigJk8YmlnPjxmb250IGNvbG9yPVxcXCJyZWRcXFwiPuKtkOivpeW9seeJhy/op4bpopHmsqHmnInnm7jlhbPnq5blsY/nn63op4bpopHlk6Z+4q2QPC9mb250PjwvYmlnPicsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICd0b2FzdDovL+mDveayoeacie+8jO+8jOS9oOeCueWVpeWRgH4nLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogJ+aVrOivt+acn+W+hX4nLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJ1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAg56uW5bGP5Lmf57K+5b2p5pWw5o2uLmZvckVhY2gobGlzdCA9PiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogbGlzdC50aXRsZSxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltZzogbGlzdC5jb3ZlciArIFxcXCJAUmVmZXJlcj1cXFwiLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBsaXN0LmxpbmsgKyBsYXp5LFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogbGlzdC5zdWJ0aXRsZSArICdcXFxcbicgKyBsaXN0LmxvbmdfdGl0bGUsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzFfbGVmdF9waWMnLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogbGlzdC5saW5rLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFpZDogbGlzdC5haWQsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnZpZDogbGlzdC5idmlkLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNpZDogbGlzdC5jaWQsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFkZ2U6IGxpc3QuYmFkZ2VcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0SG9tZVJlc3VsdChkKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIH0sIOerluWxj+S5n+eyvuW9qeaVsOaNriwgbGF6eSlcXHJcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+ayoeacieaVsOaNruWTpn4nXFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSAn8J+UpeeyvuW9qeS6jOWImycpIHtcXHJcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIOeyvuW9qeS6jOWIm+aVsOaNriA9IERhdGEuc2VjdGlvblsyXS5lcGlzb2RlcztcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAkKCkucnVsZSgo57K+5b2p5LqM5Yib5pWw5o2uLCBsYXp5KSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgZCA9IFtdO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNldFBhZ2VUaXRsZSgn8J+UpeeyvuW9qeS6jOWImycpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICjnsr7lvankuozliJvmlbDmja4gPT0gW10gfHwg57K+5b2p5LqM5Yib5pWw5o2uID09ICcnKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+KAmOKAmOKAmeKAmTxiaWc+PGZvbnQgY29sb3I9XFxcInJlZFxcXCI+4q2Q6K+l5b2x54mHL+inhumikeayoeacieS6jOWIm+S9nOWTgeWTpn7irZA8L2ZvbnQ+PC9iaWc+JyxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ3RvYXN0Oi8v6YO95rKh5pyJ77yM77yM5L2g54K55ZWl5ZGAficsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiAn5pWs6K+35pyf5b6FficsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICDnsr7lvankuozliJvmlbDmja4uZm9yRWFjaChsaXN0ID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8g6ZKI5a+56YOo5YiG5Y+C5pWw57y65aSx55qE5oOF5Ya15aaC5Yeh5Lq65L+u5LuZ5Lyg5YaZ55qE77yM77yMXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsaXN0LmFpZCA9PSAwIHx8IGxpc3QuY2lkID09IDApIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZWRlb0RhdGEgPSBKU09OLnBhcnNlKGZldGNoKFxcXCJodHRwczovL2FwaS5iaWxpYmlsaS5jb20veC93ZWItaW50ZXJmYWNlL3ZpZXc/YWlkPVxcXCIgKyBsaXN0Lmxpbmsuc3BsaXQoJ2F2JylbMV0sIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJVc2VyLUFnZW50XFxcIjogUENfVUEsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogJ2h0dHBzOi8vd3d3LmJpbGliaWxpLmNvbS8nXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6IFxcXCJHRVRcXFwiXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkuZGF0YTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFpZCA9IHZpZWRlb0RhdGEuYWlkO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnZpZCA9IHZpZWRlb0RhdGEuYnZpZDtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNpZCA9IHZpZWRlb0RhdGEuY2lkO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWlkID0gbGlzdC5haWQ7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidmlkID0gbGlzdC5idmlkO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2lkID0gbGlzdC5jaWQ7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBsaXN0LnRpdGxlLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW1nOiBsaXN0LmNvdmVyICsgXFxcIkBSZWZlcmVyPVxcXCIsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGxpc3QubGluayArIGxhenksXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBsaXN0LnN1YnRpdGxlICsgJ1xcXFxuJyArIGxpc3QubG9uZ190aXRsZSxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnbW92aWVfMV9sZWZ0X3BpYycsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBsaXN0LmxpbmssXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWlkOiBhaWQsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnZpZDogYnZpZCxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaWQ6IGNpZCxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYWRnZTogbGlzdC5iYWRnZVxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRIb21lUmVzdWx0KGQpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgfSwg57K+5b2p5LqM5Yib5pWw5o2uLCBsYXp5KVxcclxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5rKh5pyJ5pWw5o2u5ZOmfidcXHJcXG4gICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5q2j5Zyo6L+b5YWlXFxcIiArIGlucHV0ICsgXFxcIueVjOmdoi4uLlxcXCI7XFxyXFxuICAgICAgICB9KVxcclxcbiAgICB9KSxcXHJcXG4gICAgY29sX3R5cGU6IFxcXCJpY29uXzVcXFwiLFxcclxcbiAgICBleHRyYToge1xcclxcbiAgICAgICAgaWQ6ICfnsr7lvannu6fnu60nXFxyXFxuICAgIH1cXHJcXG59KTtcXHJcXG4vLyDmmL7npLrmqKHlvI/mm7TmlLnmqKHlnZdcXHJcXG5kLnB1c2goe1xcclxcbiAgICB0aXRsZTogZ2V0SXRlbSgn5qih5byPJywgJ+WPjOi+uScpLFxcclxcbiAgICBpbWc6IGdldEl0ZW0oJ+aooeW8jycsICflj4zovrknKSA9PSAn5YiX6KGoJyA/IFxcXCJoaWtlcjovL2ZpbGVzL3J1bGVzL2N5L2JpbGlfcGljL+WIl+ihqC5wbmdcXFwiIDogJ2hpa2VyOi8vZmlsZXMvcnVsZXMvY3kvYmlsaV9waWMv5Y+M6L65LnBuZycsXFxyXFxuICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoKSA9PiB7XFxyXFxuICAgICAgICDmmL7npLrnmoTliafpm4bliJfooaggPSBKU09OLnBhcnNlKGdldE15VmFyKCfmmL7npLrnmoTliafpm4bliJfooagnKSk7XFxyXFxuICAgICAgICBpZiAoZ2V0SXRlbSgn5qih5byPJywgJ+WPjOi+uScpID09ICfliJfooagnKSB7XFxyXFxuICAgICAgICAgICAg5pi+56S655qE5Ymn6ZuG5YiX6KGoLmZvckVhY2goZWwgPT4ge1xcclxcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGVsLmxpbmssIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnbW92aWVfMicsXFxyXFxuICAgICAgICAgICAgICAgIH0pO1xcclxcbiAgICAgICAgICAgIH0pO1xcclxcbiAgICAgICAgICAgIHNldEl0ZW0oJ+aooeW8jycsICflj4zovrknKVxcclxcbiAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICDmmL7npLrnmoTliafpm4bliJfooaguZm9yRWFjaChlbCA9PiB7XFxyXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oZWwubGluaywge1xcclxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdtb3ZpZV8xX2xlZnRfcGljJyxcXHJcXG4gICAgICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgc2V0SXRlbSgn5qih5byPJywgJ+WIl+ihqCcpXFxyXFxuICAgICAgICB9XFxyXFxuICAgICAgICBpbWdMaW5rID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ+WbvuaghycpO1xcclxcbiAgICAgICAgdXBkYXRlSXRlbSgn5pi+56S65qih5byPJywge1xcclxcbiAgICAgICAgICAgIHRpdGxlOiBnZXRJdGVtKCfmqKHlvI8nLCAn5Y+M6L65JyksXFxyXFxuICAgICAgICAgICAgaW1nOiBnZXRJdGVtKCfmqKHlvI8nLCAn5Y+M6L65JykgPT0gJ+WIl+ihqCcgPyBcXFwiaGlrZXI6Ly9maWxlcy9ydWxlcy9jeS9iaWxpX3BpYy/liJfooagucG5nXFxcIiA6ICdoaWtlcjovL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5My5jb25jYXQodGl0bGVBcnIpO1xcclxcbiAgICB0aXRsZUFyciA9IGJhcnJ5Mi5jb25jYXQodGl0bGVBcnIpO1xcclxcbiAgICB0aXRsZUFyciA9IGJhcnJ5MS5jb25jYXQodGl0bGVBcnIpO1xcclxcbiAgICBldmFsKCdvcD1qc29uLnNldHRpbmdzLicgKyDmnaXmupApO1xcclxcbiAgICB0aXRsZUFyciA9IHRpdGxlQXJyLm1hcCgoaXQpID0+IHtcXHJcXG4gICAgICAgIHJldHVybiBpdCA9PT0gb3AgPyAn8J+RiScgKyBpdCA6IGl0O1xcclxcbiAgICB9KTtcXHJcXG4gICAgcHV0TXlWYXIoJ+ino+aekOaVsOe7hCcsIHRpdGxlQXJyKTtcXHJcXG4gICAgcHV0TXlWYXIoJ3NldEZpbGUnLCBzZXRGaWxlKTtcXHJcXG59KSlcXHJcXG5ldmFsKGdldE15VmFyKCfnroDmj5InKSk7XFxyXFxuZC5wdXNoKHtcXHJcXG4gICAgdGl0bGU6ICfop6PmnpDvvJrwn5SYPGZvbnQgY29sb3I9XFxcIicgKyBDb2xvciArICdcXFwiPicgKyBvcCArICc8L2ZvbnQ+XFxcXHRcXFxcdOmhteegge+8mjxmb250IGNvbG9yPVxcXCInICsgQ29sb3IgKyAnXFxcIj4nICsgKChnZXRNeVZhcign5YiG6ZuG6LW3JywgJ+mmlumhtScpID09ICfpppbpobUnKSA/ICfpppbpobUnIDogKGdldE15VmFyKCfliIbpm4botbcnKSArICctJyArIGdldE15VmFyKCfliIbpm4bnu4gnKSkpICsgJzwvZm9udD4nLFxcclxcbiAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGpzb24sIOadpea6kCwgQ29sb3IsIG9wLCDlvbHniYflkI3np7AsIOaQnOe0ouaooeW8jywg6LCD55So5ZCN56ewKSA9PiB7XFxyXFxuICAgICAgICBldmFsKGdldE15VmFyKCfnroDmj5InKSk7XFxyXFxuICAgICAgICByZXR1cm4gJChldmFsKGdldE15VmFyKCfop6PmnpDmlbDnu4QnKSksIDMpLnNlbGVjdCgoanNvbiwg5p2l5rqQLCBDb2xvciwgb3AsIOW9seeJh+WQjeensCwg5pCc57Si5qih5byPLCDosIPnlKjlkI3np7ApID0+IHtcXHJcXG4gICAgICAgICAgICBzZXRGaWxlID0gZ2V0TXlWYXIoJ3NldEZpbGUnKTtcXHJcXG4gICAgICAgICAgICBpbnB1dCA9IGlucHV0LnJlcGxhY2UoL/CfkYkvZywgJycpO1xcclxcbiAgICAgICAgICAgIGlmIChpbnB1dCA9PT0gJ+Kcje+4j+i+heWKqScpIHtcXHJcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoKS5ydWxlKCgpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGV2YWwoSlNPTi5wYXJzZShyZXF1ZXN0KCdoaWtlcjovL3BhZ2UvaG9tZT9ydWxlPemFjee9ruWKqeaJiycpKS5ydWxlKTtcXHJcXG4gICAgICAgICAgICAgICAgfSlcXHJcXG4gICAgICAgICAgICB9ZWxzZSBpZiAoaW5wdXQgPT09ICfwn5Om77iP6a2U5patJykge1xcclxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9Sb3V0ZT9ydWxlPU15RmllbGThtLDigb8mdHlwZT3nvJbovpEjbm9IaXN0b3J5I1xcXCI7XFxyXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gJ/CflI3mkJzntKInKSB7XFxyXFxuICAgICAgICAgICAgICAgIGlmICjmkJzntKLmqKHlvI8gPT0gJ+WIhue7hCcpIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9zZWFyY2g/cz1cXFwiICsg5b2x54mH5ZCN56ewICsgXFxcIiZncm91cD1cXFwiICsg6LCD55So5ZCN56ewO1xcclxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3NlYXJjaD9zPVxcXCIgKyDlvbHniYflkI3np7AgKyBcXFwiJnJ1bGU9XFxcIiArIOiwg+eUqOWQjeensDtcXHJcXG4gICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAvLyDljp/lhYjnmoTphY3nva5cXHJcXG4gICAgICAgICAgICBvcmlnaW5TZXR0aW5ncyA9IEpTT04uc3RyaW5naWZ5KGpzb24uc2V0dGluZ3MpO1xcclxcbiAgICAgICAgICAgIC8vIOS/ruaUuemFjee9rlxcclxcbiAgICAgICAgICAgIGV2YWwoJ2pzb24uc2V0dGluZ3MuJyArIOadpea6kCArICc9aW5wdXQ7Jyk7XFxyXFxuICAgICAgICAgICAgc2V0RmlsZSA9IHNldEZpbGUucmVwbGFjZShvcmlnaW5TZXR0aW5ncywgSlNPTi5zdHJpbmdpZnkoanNvbi5zZXR0aW5ncykpO1xcclxcbiAgICAgICAgICAgIHNhdmVGaWxlKCdoaWtlcjovL2ZpbGVzL3J1bGVzL0R1YW5OaWFuL015UGFyc2UuanNvbicsIHNldEZpbGUpO1xcclxcbiAgICAgICAgICAgIC8vIOWIt+aWsOWFg+e0oFxcclxcbiAgICAgICAgICAgIGV2YWwoZ2V0TXlWYXIoJ+eugOaPkicpKTtcXHJcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKCdvcCcsIHtcXHJcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfop6PmnpDvvJrwn5SYPGZvbnQgY29sb3I9XFxcIicgKyBDb2xvciArICdcXFwiPicgKyBvcCArICc8L2ZvbnQ+XFxcXHRcXFxcdOmhteegge+8mjxmb250IGNvbG9yPVxcXCInICsgQ29sb3IgKyAnXFxcIj4nICsgKChnZXRNeVZhcign5YiG6ZuG6LW3JywgJ+mmlumhtScpID09ICfpppbpobUnKSA/ICfpppbpobUnIDogKGdldE15VmFyKCfliIbpm4botbcnKSArICctJyArIGdldE15VmFyKCfliIbpm4bnu4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C9mb250PlxcXFx0XFxcXHTpobXnoIHvvJo8Zm9udCBjb2xvcj1cXFwiJyArIENvbG9yICsgJ1xcXCI+JyArICgoZ2V0TXlWYXIoJ+WIhumbhui1tycsICfpppbpobUnKSA9PSAn6aaW6aG1JykgPyAn6aaW6aG1JyA6IChnZXRNeVZhcign5YiG6ZuG6LW3JykgKyAnLScgKyBnZXRNeVZhcign5YiG6ZuG57uIJykpKSArICc8L2ZvbnQ+JyxcXHJcXG4gICAgICAgIH0pXFxyXFxuICAgICAgICAvLyDliKDpmaRcXHJcXG4gICAgICAgIOaYvuekuueahOWJp+mbhuWIl+ihqCA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoJ+aYvuekuueahOWJp+mbhuWIl+ihqCcpKTtcXHJcXG4gICAgICAgIOaYvuekuueahOWJp+mbhuWIl+ihqC5mb3JFYWNoKGVsID0+IHtcXHJcXG4gICAgICAgICAgICBkZWxldGVJdGVtKGVsLmxpbmspO1xcclxcbiAgICAgICAgfSk7XFxyXFxuICAgICAgICAvLyDmt7vliqBcXHJcXG4gICAgICAgIGxhenkgPSBnZXRNeVZhcignbGF6eScpO1xcclxcbiAgICAgICAg5Ymn6ZuG5YiX6KGoID0gSlNPTi5wYXJzZShnZXRNeVZhcign5Ymn6ZuG5YiX6KGoJykpO1xcclxcbiAgICAgICAg5pi+56S655qE5Ymn6ZuG5YiX6KGoID0g5Ymn6ZuG5YiX6KGoLnNsaWNlKHN0YXJ0IC0gMSwgZW5kKTtcXHJcXG4gICAgICAgIG5ld0FycmF5ID0gW107XFxyXFxuICAgICAgICBpbmRleCA9IDE7XFxyXFxuICAgICAgICDmmL7npLrnmoTliafpm4bliJfooaguZm9yRWFjaChsaXN0ID0+IHtcXHJcXG4gICAgICAgICAgICBpZiAoZ2V0SXRlbSgn5qih5byPJywgJ+WPjOi+uScpID09ICfliJfooagnKSB7XFxyXFxuICAgICAgICAgICAgICAgIG5ld0FycmF5LnB1c2goe1xcclxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGxpc3QubG9uZ190aXRsZSxcXHJcXG4gICAgICAgICAgICAgICAgICAgIGltZzogbGlzdC5jb3ZlciArIFxcXCJAUmVmZXJlcj1cXFwiLFxcclxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBsaXN0LmxpbmsgKyBsYXp5LFxcclxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogbGlzdC50aXRsZS5tYXRjaCgvWzAtOV0vKSA/IChsaXN0LmJhZGdlICsgJ+esrCcgKyBsaXN0LnRpdGxlICsgJ+ivnScpIDogbGlzdC50aXRsZSxcXHJcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnbW92aWVfMV9sZWZ0X3BpYycsXFxyXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBsaXN0LmxpbmssXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgYWlkOiBsaXN0LmFpZCxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBidmlkOiBsaXN0LmJ2aWQsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2lkOiBsaXN0LmNpZCxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWRnZTogbGlzdC5iYWRnZVxcclxcbiAgICAgICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgICAgICBuZXdBcnJheS5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBsaXN0LmxvbmdfdGl0bGUsXFxyXFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGxpc3QuY292ZXIgKyBcXFwiQFJlZmVyZXI9XFxcIixcXHJcXG4gICAgICAgICAgICAgICAgICAgIHVybDogbGlzdC5saW5rICsgbGF6eSxcXHJcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IGxpc3QudGl0bGUubWF0Y2goL1swLTldLykgPyAobGlzdC5iYWRnZSArICfnrKwnICsgbGlzdC50aXRsZSArICfor50nKSA6IGxpc3QudGl0bGUsXFxyXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzInLFxcclxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZDogbGlzdC5saW5rLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGFpZDogbGlzdC5haWQsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnZpZDogbGlzdC5idmlkLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNpZDogbGlzdC5jaWQsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgYmFkZ2U6IGxpc3QuYmFkZ2VcXHJcXG4gICAgICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgIGluZGV4ICs9IDE7XFxyXFxuICAgICAgICB9KTtcXHJcXG4gICAgICAgIGFkZEl0ZW1BZnRlcihnZXRNeVZhcign5pyr6aG1JyksIG5ld0FycmF5KTtcXHJcXG4gICAgICAgIHB1dE15VmFyKCfmmL7npLrnmoTliafpm4bliJfooagnLCDmmL7npLrnmoTliafpm4bliJfooagpO1xcclxcbiAgICB9KSk7XFxyXFxuICAgIGQucHVzaCh7XFxyXFxuICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcclxcbiAgICAgICAgdXJsOiAnaGlrZXI6Ly9lbXB0eScsXFxyXFxuICAgICAgICB0aXRsZTogJ+KItycsXFxyXFxuICAgICAgICBleHRyYToge1xcclxcbiAgICAgICAgICAgIGlkOiAn5Y2g5L2N56ymJyxcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgfSlcXHJcXG4gICAgcHV0TXlWYXIoJ+WIhumbhui1tycsIDEpO1xcclxcbiAgICBwdXRNeVZhcign5YiG6ZuG57uIJywg5q+P6aG16ZuG5pWwKTtcXHJcXG4gICAgcHV0TXlWYXIoJ+WJp+mbhuWIl+ihqCcsIOWJp+mbhuWIl+ihqCk7XFxyXFxuICAgIOaAu+mhteaVsCA9IE1hdGguY2VpbCjliafpm4bplb/luqYgLyDmr4/pobXpm4bmlbApO1xcclxcbiAgICBzdGFydCA9IDE7XFxyXFxuICAgIGVuZCA9IOavj+mhtembhuaVsDtcXHJcXG4gICAgZm9yIChsZXQgcGFnZSA9IDE7IHBhZ2UgPD0g5oC76aG15pWwOyBwYWdlKyspIHtcXHJcXG4gICAgICAgIGlmIChlbmQgPiDliafpm4bplb/luqYpIHtcXHJcXG4gICAgICAgICAgICBlbmQgPSDliafpm4bplb/luqY7XFxyXFxuICAgICAgICB9XFxyXFxuICAgICAgICBkLnB1c2goe1xcclxcbiAgICAgICAgICAgIHRpdGxlOiBzdGFydCArICctJyArIGVuZCxcXHJcXG4gICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjI25vSGlzdG9yeSMnKS5sYXp5UnVsZSgoc3RhcnQsIGVuZCwgQ29sb3IsIOadpea6kCkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICBldmFsKGdldE15VmFyKCfliLfmlrDpgInpm4YnKSk7XFxyXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxyXFxuICAgICAgICAgICAgfSwgc3RhcnQsIGVuZCwgQ29sb3IsIOadpea6kCksXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXHJcXG4gICAgICAgICAgICBleHRyYToge1xcclxcbiAgICAgICAgICAgICAgICBpZDogc3RhcnQgKyAnLScgKyBlbmRcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICB9KTtcXHJcXG4gICAgICAgIGlmIChlbmQgPCDliafpm4bplb/luqYpIHtcXHJcXG4gICAgICAgICAgICB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bGVmdF9waWMnLFxcclxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxyXFxuICAgICAgICAgICAgICAgIGlkOiBsaXN0LmxpbmssXFxyXFxuICAgICAgICAgICAgICAgIGFpZDogbGlzdC5haWQsXFxyXFxuICAgICAgICAgICAgICAgIGJ2aWQ6IGxpc3QuYnZpZCxcXHJcXG4gICAgICAgICAgICAgICAgY2lkOiBsaXN0LmNpZCxcXHJcXG4gICAgICAgICAgICAgICAgYmFkZ2U6IGxpc3QuYmFkZ2VcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICB9KTtcXHJcXG4gICAgfSBlbHNlIHtcXHJcXG4gICAgICAgIGQucHVzaCh7XFxyXFxuICAgICAgICAgICAgdGl0bGU6IGxpc3QubG9uZ190aXRsZSxcXHJcXG4gICAgICAgICAgICBpbWc6IGxpc3QuY292ZXIgKyBcXFwiQFJlZmVyZXI9XFxcIixcXHJcXG4gICAgICAgICAgICB1cmw6IGxpc3QubGluayArIGxhenksXFxyXFxuICAgICAgICAgICAgZGVzYzogbGlzdC50aXRsZS5tYXRjaCgvWzAtOV0vKSA/IChsaXN0LmJhZGdlICsgJ+esrCcgKyBsaXN0LnRpdGxlICsgJ+ivnScpIDogbGlzdC50aXRsZSxcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzInLFxcclxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxyXFxuICAgICAgICAgICAgICAgIGlkOiBsaXN0LmxpbmssXFxyXFxuICAgICAgICAgICAgICAgIGFpZDogbGlzdC5haWQsXFxyXFxuICAgICAgICAgICAgICAgIGJ2aWQ6IGxpc3QuYnZpZCxcXHJcXG4gICAgICAgICAgICAgICAgY2lkOiBsaXN0LmNpZCxcXHJcXG4gICAgICAgICAgICAgICAgYmFkZ2U6IGxpc3QuYmFkZ2VcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICB9KTtcXHJcXG4gICAgfVxcclxcbiAgICBpbmRleCArPSAxO1xc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GlzdC5saXN0LmNhcmRzO1xcbiAgICAgICAgICAgIGxpc3RzLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgLy9sb2coaXRlbSlcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwaWMgPSBpdGVtLnBhcmFtcy5uZXdfcGljX3Z0IHx8IGl0ZW0ucGFyYW1zLmltYWdlX3VybCB8fCBpdGVtLnBhcmFtcy5uZXdfcGljX2h6IHx8IGl0ZW0ucGFyYW1zLmltYWdlX3VybF92ZXJ0aWNhbCB8fCBpdGVtLnBhcmFtcy5waWNfNTQweDMwNCB8fCBpdGVtLnBhcmFtcy5waWM0OTZ4MjgwO1xcbiAgICAgICAgICAgICAgICAgICAgaWYoL1xcXFwuanBnXFxcXC8vLnRlc3QocGljKSl7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgaW5kZXggPSBwaWMubGFzdEluZGV4T2YoXFxcIlxcXFwvXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBwaWMgPSBwaWMuc3Vic3RyaW5nKDAsIGluZGV4KTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGxldCBkZXMgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLnBhcmFtcy5pbWd0YWcpIHsgIFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHR5cGVvZihpdGVtLnBhcmFtcy5pbWd0YWcpID09PSBcXFwib2JqZWN0XFxcIil7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBpbWd0YWcgPSBKU09OLnBhcnNlKGl0ZW0ucGFyYW1zLmltZ3RhZyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKGltZ3RhZykgICAgICAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgICAgICAgICAgZGVzID0gaW1ndGFnLnRhZ18zLnRleHQgPyBpbWd0YWcudGFnXzMudGV4dCA6IGltZ3RhZy50YWdfMi50ZXh0LnNwbGl0KFxcXCItXFxcIilbMF1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXMgPSBpdGVtLnBhcmFtcy5pbWd0YWc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICBkZXMgPSBpdGVtLnBhcmFtcy50aW1lbG9uZyB8fCBpdGVtLnBhcmFtcy5wdWJsaXNoX2RhdGUgfHwgaXRlbS5wYXJhbXMuZXBpc29kZV91cGRhdGVkIHx8IChpdGVtLnBhcmFtcy5kdXJhdGlvbiA/IHNlY29uZHNUb1RpbWUoaXRlbS5wYXJhbXMuZHVyYXRpb24pIDogXFxcIlxcXCIpIHx8IChpdGVtLnBhcmFtcy5jbXNfaXN2aXAgPT0gMSA/IFxcXCJWSVBcXFwiIDogXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGxldCBwYXJhbV9jaWQgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLnBhcmFtcy5jaWQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbV9jaWQgPSBpdGVtLnBhcmFtcy5jaWQ7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGl0ZW0ucGFyYW1zLmF0dGFjaGVkX2lkKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1fY2lkID0gaXRlbS5wYXJhbXMuYXR0YWNoZWRfaWQ7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhpdGVtKVxcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5wYXJhbXMudGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogZGVzLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IHBpYyxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5I2ltbWVyc2l2ZVRoZW1lIyNhdXRvQ2FjaGUjXFxcIiskKFxcXCJcXFwiKS5ydWxlKCgpPT4ge1xcbiAgICByZXF1aXJlKFxcXCJodHRwczovL2dpdGNvZGUubmV0L2dmNDQ4ODAyNi9Iay8tL3Jhdy9KdS9TcmNKdS5qc1xcXCIpO1xcbiAgICBlcmppKCk7XFxufSksXFxuIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuICBcXFwiaW1nXFxcIjogcGljLFxcblxcXCJuYW1lXFxcIjogaXRlbS5wYXJhbXMudGl0bGUsXFxuXFxcInBhZ2VUaXRsZVxcXCI6aXRlbS5wYXJhbXMudGl0bGUsXFxuXFxcInNuYW1lXFxcIjpcXFwi6IW+6K6v6KeG6aKRXFxcIixcXG5cXFwic3R5cGVcXFwiOlxcXCLmraPniYhcXFwiLFxcblxcXCJzdXJsXFxcIjpcXFwiaHR0cHM6Ly9ub2RlLnZpZGVvLnFxLmNvbS94L2FwaS9mbG9hdF92aW5mbzI/Y2lkPVxcXCIraXRlbS5wYXJhbXMuY2lkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhlLnRvU3RyaW5nKCkpXFxuICAgICAgICAgICAgICAgICAgICBsb2coaXRlbSlcXG4gICAgICAgICAg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G4gICAgICAgICAgICAgICAgICAgIHRpdGxlID0ga2V5LnRvU3RyaW5nKCkgPT09IGNhdGVfdGVtcFtpbmRleF0gPyAn4oCc4oCc4oCd4oCdPGI+PHNwYW4gc3R5bGU9XFxcImNvbG9yOiAnICsg5YiG57G76aKc6ImyICsgJ1xcXCI+JyArIHRpdGxlICsgJzwvc3Bhbj48L2I+JyA6IHRpdGxlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6ICQob3BfdmFsdWUgKyAnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG5ld19jYXRlID0gW11cXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wLmZvckVhY2goKGNhdGUsIGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld19jYXRlLnB1c2goaW5kZXggPT09IDAgPyBwYXJhbXMua2V5LnRvU3RyaW5nKCkgOiBcXFwiMFxcXCIpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBwYXJhbXMuU2ZpbHRlcl9rZXkubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihwYXJhbXMuU2ZpbHRlcl9rZXlbaV0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdoZWFkZXIuY2F0ZWdvcnknLCBKU09OLnN0cmluZ2lmeShuZXdfY2F0ZSkpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIocGFyYW1zLmNsYXNzX2tleSwgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UodHJ1ZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxuICAgICAgICAgICAgICAgICAgICAgICAga2V5OiBrZXksXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3Nfa2V5OiBjbGFzc19rZXksXFxuICAgICAgICAgICAgICAgICAgICAgICAgU2ZpbHRlcl9rZXk6IFNmaWx0ZXJfa2V5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2U6IHBhZ2UsXFxuICAgICAgICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSlcXG5cXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIlxcbiAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgfSBlbHNlIGlmIChmb2xkID09PSAnMScpIHtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBzdWJfY2F0ZWdvcmllcy5mb3JFYWNoKChpdGVtLCBrZXkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCB0aXRsZSA9IGl0ZW0ucGFyYW1zLm9wdGlvbl9uYW1lO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IG9wX3ZhbHVlID0gaXRlbS5wYXJhbXMub3B0aW9uX3ZhbHVlO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKGNsYXNzX2tleSkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IGdldE15VmFyKGNsYXNzX2tleSkgPT0gb3BfdmFsdWUgPyAn4oCc4oCc4oCd4oCdPGI+PHNwYW4gc3R5bGU9XFxcImNvbG9yOiAnICsg5YiG57G76aKc6ImyICsgJ1xcXCI+JyArIHRpdGxlICsgJzwvc3Bhbj48L2I+JyA6IHRpdGxlO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IGtleS50b1N0cmluZygpID09PSBjYXRlX3RlbXBbaW5kZXhdID8gJ+KAnOKAnOKAneKAnTxiPjxzcGFuIHN0eWxlPVxcXCJjb2xvcjogJyArIOWIhuexu+minOiJsiArICdcXFwiPicgKyB0aXRsZSArICc8L3NwYW4+PC9iPicgOiB0aXRsZTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJChvcF92YWx1ZSArICcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmNhdGVfdGVtcFtwYXJhbXMuaW5kZXhdID0gcGFyYW1zLmtleS50b1N0cmluZygpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdoZWFkZXIuY2F0ZWdvcnknLCBKU09OLnN0cmluZ2lmeShwYXJhbXMuY2F0ZV90ZW1wKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIocGFyYW1zLmNsYXNzX2tleSwgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKHRydWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleDogaW5kZXgsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleToga2V5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc19rZXk6IGNsYXNzX2tleSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgIGxvZyhzdWJfY2F0ZWdvcmllcylcXG4gICAgICAgICAgICAgICAgbG9nKGUudG9TdHJpbmcoKSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCJcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG5cXG4gICAgfSlcXG59XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLmibnph4/mjILovb3lvLnluZVcIixcInBhdGhcIjpcImRtTW91bnRcIixcInJ1bGVcIjpcImpzOlxcbmxldCBkID0gW107XFxuYWRkTGlzdGVuZXIoXFxcIm9uQ2xvc2VcXFwiLCAoKSA9PiBjbGVhck15VmFyKFxcXCJkbGxhc3RUaW1lXFxcIikpXFxuZC5wdXNoKHtcXG4gICAgdGl0bGU6IFxcXCLmuIXnqbrmjILovb3liJ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