We put the details of component in final output array
a . push ( j ) ; b . push ( w ) ; c . push ( ans ) ; } document . write ( a . length + " " ) ; for ( let j = 0 ; j < a . length ; ++ j ) document . write ( a [ j ] + " " + b [ j ] + " " + c [ j ] + " " ) ; }