{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be wise and beloved by his people. Now he is just like a boy in love and can’t refuse any request from the devil. Also, this devil is looking like a very cute Loli.\n \u003cbr\u003e\n \u003cbr\u003e Let us continue our story, z*p(actually you) defeat the \u0027MengMengDa\u0027 party\u0027s leader, and the \u0027MengMengDa\u0027 party dissolved. z*p becomes the most famous guy among the princess\u0027s knight party. \n \u003cbr\u003e\n \u003cbr\u003e One day, the people in the party find that z*p has died. As what he has done in the past, people just say \u0027Oh, what a nice boat\u0027 and don\u0027t care about why he died.\n \u003cbr\u003e\n \u003cbr\u003e Since then, many people died but no one knows why and everyone is fine about that. Meanwhile, the devil sends her knight to challenge you with Algorithm contest.\n \u003cbr\u003e\n \u003cbr\u003e There is a hard data structure problem in the contest:\n \u003cbr\u003e\n \u003cbr\u003e There are n numbers a_1,a_2,...,a_n on a line, everytime you can change every number in a segment [l,r] into a number x(type 1), or change every number a_i in a segment [l,r] which is bigger than x to gcd(a_i,x) (type 2).\n \u003cbr\u003e\n \u003cbr\u003e You should output the final sequence.\n\u003c/div\u003e\n给你一个区间,每次可以进行两种操作,1:把区间中的数全都变成x 2:把区间中大于x的数变成gcd(a[i], x),最后输出序列。"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains an integer T, denoting the number of the test cases.\n\u003cbr\u003e For each test case, the first line contains a integers n.\n\u003cbr\u003e The next line contains n integers a_1,a_2,...,a_n separated by a single space.\n\u003cbr\u003e The next line contains an integer Q, denoting the number of the operations.\n\u003cbr\u003e The next Q line contains 4 integers t,l,r,x. t denotes the operation type.\n\u003cbr\u003e\n\u003cbr\u003e \u003cb\u003eT\u0026lt;\u003d2,n,Q\u0026lt;\u003d100000\u003cbr\u003e a_i,x \u0026gt;\u003d0\u003cbr\u003e a_i,x is in the range of int32(C++)\u003c/b\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output a line with n integers separated by a single space representing the final sequence.\n\u003cbr\u003e \u003cb\u003ePlease output a single more space after end of the sequence\u003c/b\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e1\n10\n16807 282475249 1622650073 984943658 1144108930 470211272 101027544 1457850878 1458777923 2007237709 \n10\n1 3 6 74243042\n2 4 8 16531729\n1 3 4 1474833169\n2 1 8 1131570933\n2 7 9 1505795335\n2 3 7 101929267\n1 4 10 1624379149\n2 2 8 2110010672\n2 6 7 156091745\n1 2 5 937186357\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e16807 937186357 937186357 937186357 937186357 1 1 1624379149 1624379149 1624379149 \u003c/pre\u003e"}}]}