This is not correct "a(i) mod a(ind(i)) = 0 and a(ind(i)) is smallest and brd(ind(i)) is max length", because take for example test:
5
2 3 9 16 144
So in this case output should be 2 16 144, and your output is 3 9 144
When you compare 2 sequences you need to compare them first by 1st element, than by 2nd, and so on, but you are comparing 2 sequences just by last element.
Well it's easier to solve it when you reverse things because you don't have problem when you compare 2 sequences lexicographically, but you can solve it this way also.
Let's make a matrix better[i][j] which is true if sequence which ends with a[i] is better than sequence which ends with a[j], false otherwise.
So better[i][j] is defined:
if brd[i] > brd[j] then better[i][j] = true
if brd[i] < brd[j] then better[i][j] = false
if brd[i] = brd[j] then
if ( ind[i] != ind[j] ) then better[i][j] = better[ ind[i] ][ ind[j] ]
if ( ind[i] == ind[j] ) then better[i][j] = a[i] > a[j]
So now you can compare 2 sequences with this matrix better[][].
I hope I helped, if you have more question just ask...