Language: C

a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
int Q(*a,*b){
    for(i=0;i<N;printf("%c%d%s",a[i],b[i],i==N-1?"\n":" "),i++);
}
B(){
    for(i=0;i<N;i++)
    for(j=N-1;j>0;j--)
        if(t[j-1]>t[j]){
            t[j]^=t[j-1]^=t[j]^=t[j-1];
            c[j]^=c[j-1]^=c[j]^=c[j-1];
        }
    Q(c,t);
    puts("Stable");
}
S(){
    for(i=0;i<N;i++){
        for(j=p=i;j<N;j++)if(T[j]<T[p])p=j;
        P=T[p];T[p]=T[i];T[i]=P;
        P=C[p];C[p]=C[i];C[i]=P;
    }
    Q(C,T);
    for(i=p=0;i<N;i++)if(c[i]==C[i]&&t[i]==T[i])p++;
    puts(p==N?"Stable":"Not stable");
}

int main(){
    for(scanf("%d",&N);i<N;scanf(" %c%d",&c[i],&t[i]),T[i]=t[i],C[i]=c[i],i++);
    B();S();

}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
      |   ^
main.c:1:5: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
      |     ^
main.c:1:7: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
      |       ^
main.c:1:9: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
      |         ^
main.c:1:11: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
      |           ^
main.c:1:13: error: type defaults to 'int' in declaration of 'P' [-Wimplicit-int]
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
      |             ^
main.c:1:15: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
      |               ^
main.c:1:21: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
      |                     ^
main.c:1:27: error: type defaults to 'int' in declaration of 'T' [-Wimplicit-int]
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
      |                           ^
main.c:1:33: error: type defaults to 'int' in declaration of 'C' [-Wimplicit-int]
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
      |                                 ^
main.c:2:7: error: expected declaration specifiers or '...' before '*' token
    2 | int Q(*a,*b){
      |       ^
main.c:2:10: error: expected declaration specifiers or '...' before '*' token
    2 | int Q(*a,*b){
      |          ^
main.c:5:1: error: return type defaults to 'int' [-Wimplicit-int]
    5 | B(){
      | ^
main.c: In function 'B':
main.c:12:5: error: implicit declaration of function 'Q' [-Wimplicit-function-declaration]
   12 |     Q(c,t);
      |     ^
main.c:13:5: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
   13 |     puts("Stable");
      |     ^~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'puts'
  +++ |+#include <stdio.h>
    1 | a,b,i,j,N,p,P,t[36],c[36],T[36],C[36];
main.c: At top level:
main.c:15:1: error: return type defaults to 'int' [-Wimplicit-int]
   15 | S(){
      | ^
main.c: In function 'main':
main.c:27:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   27 |     for(scanf("%d",&N);i<N;scanf(" %c%d",&c[i],&t[i]),T[i]=t[i],C[i]=c[i],i++);
      |         ^~~~~
main.c:27:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:27:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:27:9: note: include '<stdio.h>' or provide a declaration of 'scanf'