you give 0indexed array num consist n distinct positive integer apply m operation array ith operation replace number operationsi0 operationsi1it guarantee ith operationoperationsi0 exist numsoperationsi1 exist numsReturn array obtain apply operation Example 1input num 1246 operation 134761output 3271explanation we perform follow operation num replace number 1 3 num 3246 replace number 4 7 num 3276 replace number 6 1 num 3271we return final array 3271example 2input num 12 operation 132132output 21explanation we perform follow operation num replace number 1 3 num 32 replace number 2 1 num 31 replace number 3 2 num 21we return array 21 Constraintsn numslengthm operationslength1 n m 105All value num distinctoperationsilength 21 numsi operationsi0 operationsi1 106operationsi0 exist num apply ith operationoperationsi1 exist num apply ith operation