write a go solution for D. Sakurako's Hobbytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFor a certain permutation p^∗ Sakurako calls an integer j reachable from an integer i if it is possible to make i equal to j by assigning i=p_i a certain number of times.If p=[3,5,6,1,2,4], then, for example, 4 is reachable from 1, because: i=1 arrow i=p_1=3 arrow i=p_3=6 arrow i=p_6=4. Now i=4, so 4 is reachable from 1.Each number in the permutation is colored either black or white.Sakurako defines the function F(i) as the number of black integers that are reachable from i.Sakurako is interested in F(i) for each 1<=i<=n, but calculating all values becomes very difficult, so she asks you, as her good friend, to compute this.^∗A permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (the number 2 appears twice in the array), and [1,3,4] is also not a permutation (n=3, but the array contains 4).InputThe first line contains a single integer t (1<=t<=10^4) — the number of test cases.The first line of each test case contains a single integer n (1<=n<=2*10^5) — the number of elements in the array.The second line of each test case contains n integers p_1,p_2,...,p_n (1<=p_i<=n) — the elements of the permutation.The third line of each test case contains a string s of length n, consisting of '0' and '1'. If s_i=0, then the number p_i is colored black; if s_i=1, then the number p_i is colored white.It is guaranteed that the sum of n across all test cases does not exceed 2*10^5.OutputFor each test case, output n integers F(1),F(2),...,F(n).ExampleInput511051 2 4 5 31010155 4 1 3 21001163 5 6 1 2 401000061 2 3 4 5 6100110Output1 0 1 1 1 1 2 2 2 2 2 4 1 4 4 1 4 0 1 1 0 0 1. Output only the code with no comments, explanation, or additional text.