a[110],i,b[5000];main(j){for(;*a-~i;)scanf("%d",a-i--);for(;a[++j]?a[j-1]>a[j]?a[j]^=a[j-1]^=a[j]^=a[j-1],b[++*b]=j:1:(j=1,++i););for(;*a=b[i];)fflush(!printf("%d %d\n"+!i++*3,b[i]-!!i*2,b[i]-1));}