Felix6326727/beyond-accuracy-code-comprehension huggingface dataset:
#!/usr/bin/env python
# encoding: utf-8

import copy


class Solution:
    def stable_sort(self):
        # write your code here
        array_length = int(input())
        array = [str(x) for x in input().split()]
        array_2 = copy.deepcopy(array)

        bubble_result = self.bubble_sort(array=array, array_length=array_length)
        selection_result = self.selection_sort(array=array_2, array_length=array_length)

        # check whether selection sort is stable
        if bubble_result == selection_result:
            print("Stable")
        else:
            print("Not stable")

    @staticmethod
    def selection_sort(array, array_length):
        # selection sort
        selection_count = 0
        for i in range(array_length):
            min_j = i
            for j in range(i, array_length):
                if array[j][1] < array[min_j][1]:
                    min_j = j
            array[i], array[min_j] = array[min_j], array[i]
            if i != min_j:
                selection_count += 1

        result = " ".join(map(str, array))
        print(result)
        return result

    @staticmethod
    def bubble_sort(array, array_length):
        flag, bubble_count, cursor = 1, 0, 0
        while flag:
            flag = 0
            for j in range(array_length - 1, cursor, -1):
                if array[j][1] < array[j - 1][1]:
                    array[j], array[j - 1] = array[j - 1], array[j]
                    flag = 1
                    bubble_count += 1
        cursor += 1
        result = " ".join(map(str, array))
        print(result)
        print("Stable")
        return result


if __name__ == '__main__':
    solution = Solution()
    solution.stable_sort()

# Example run
# Input:
-6940
DP\@LU%V
# Output:
DP\@LU%V
Stable
DP\@LU%V
Stable
def bubble_sort(c, n):
    for i in range(n):
        for j in reversed(range(i+1, n)):
            if c[j][1] < c[j-1][1]:
                c[j], c[j-1] = c[j-1], c[j]
    print(' '.join(map(str, c)))


def selection_sort(c, n):
    for i in range(n):
        m = i
        for j in range(i, n):
            if c[j][1] < c[m][1]:
                m = j
        c[i], c[m] = c[m], c[i]
    print(' '.join(map(str, c)))


n = int(input())
c = list(input().split())
b = list(c)
bubble_sort(c, n)
print('Stable')
selection_sort(b, n)
if c == b:
    print('Stable')
else:
    print('Not stable')



# Example run
# Input:
-27925
UIV5~J;T
# Output:
UIV5~J;T
Stable
UIV5~J;T
Stable
import copy

def bubble_sort(C, N):
    for i in range(N):
        for j in range(N-1, i, -1):
            if C[j][1] < C[j-1][1]:
                C[j], C[j-1] = C[j-1], C[j]

def selection_sort(C, N):
    for i in range(N):
        minj = i
        for j in range(i+1, N):
            if C[j][1] < C[minj][1]:
                minj = j
        C[i], C[minj] = C[minj], C[i]

def is_stable(in0, out0):
    for m in '123456789':
        in1 = list(filter(lambda e:e[1]==m, in0))
        out1 = list(filter(lambda e:e[1]==m, out0))
        #print(in1,out1)
        if in1 != out1:
            return 'Not stable'
    return 'Stable'

N = int(input())
C = list(input().split())
C1 = copy.deepcopy(C)
C2 = copy.deepcopy(C)
bubble_sort(C1, N)
selection_sort(C2, N)
print(*C1)
print(is_stable(C, C1))
print(*C2)
print(is_stable(C, C2))



# Example run
# Input:
-51
o\Y__
# Output:
o\Y__
Stable
o\Y__
Stable
class Card:
    def __init__(self, data, i):
        self.suit = data[0]
        self.value = data[1]
        self.initord = i

def BubbleSort(cards, N):
    for i in range(N):
        for j in range(N - 1, i, -1):
            if cards[j].value < cards[j - 1].value:
                cards[j], cards[j - 1] = cards[j - 1], cards[j]

def SelectionSort(cards, N):
    for i in range(N):
        min_j = i

        for j in range(i + 1, N):
            if cards[j].value < cards[min_j].value:
                min_j = j

        cards[i], cards[min_j] = cards[min_j], cards[i]

N = int(input())
cards = [Card(data, i) for i, data in enumerate(input().split())]

cards1 = cards.copy()
cards2 = cards.copy()

BubbleSort(cards1, N)
SelectionSort(cards2, N)

print(*[card.suit + card.value for card in cards1])

for i in range(N - 1):
    if cards1[i].value == cards1[i + 1].value:
        if cards1[i].initord > cards1[i + 1].initord:
            print("Not stable")
            break
else:
    print("Stable")

print(*[card.suit + card.value for card in cards2])

for i in range(N - 1):
    if cards2[i].value == cards2[i + 1].value:
        if cards2[i].initord > cards2[i + 1].initord:
            print("Not stable")
            break
else:
    print("Stable")

# Example run
# Input:
-31081879
7BJLT
# Output:
7B
Stable
7B
Stable
from collections import namedtuple
Card = namedtuple('Card', 'suit value')

def BubbleSort(C):
    for i in range(len(C)):
        for j in range(len(C)-1,i,-1):
            if C[j].value < C[j-1].value:
                C[j],C[j-1] = C[j-1],C[j]

def SelectionSort(C):
    for i in range(len(C)):
        mini = i
        for j in range(i,len(C)):
            if C[j].value < C[mini].value:
                mini = j
        C[i],C[mini] = C[mini],C[i]

def checkStable(C0, C1):
    result = True
    for i in range(1,10):
        f0 = [x.suit for x in list(filter(lambda c: c.value==i,C0))]
        f1 = [x.suit for x in list(filter(lambda c: c.value==i,C1))]
        if f0!=f1:
            result = False
    return result

if __name__=='__main__':
    N = int(input()) 
    Co = list(map(lambda X: Card(X[0],int(X[1])), map(list, input().split())))
    Cb,Cs = [Co[:] for _ in range(2)]
    for C, Sort in zip([Cb,Cs], [BubbleSort, SelectionSort]):
        Sort(C)
        print(*["".join([X.suit,str(X.value)]) for X in C])
        print("Stable" if checkStable(Co,C) else "Not stable")

# Example run
# Input:
115625
-15913
# Output:
-1
Stable
-1
Stable
n = int(input())
*s1, = input().split()
s2 = s1[:]

def bubbleSort(s):
    flag = True
    while flag:
        flag = False
        for i in range(n-1):
            if int(s[i][1]) > int(s[i+1][1]):
                s[i],s[i+1] = s[i+1],s[i]
                flag = True
    return s

def selectionSort(s):
    for i in range(n):
        minj = i
        for j in range(i+1,n):
            if int(s[minj][1]) > int(s[j][1]):
                minj = j
        s[i],s[minj] = s[minj],s[i]
    return s

print(' '.join(bubbleSort(s1)))
print("Stable")
print(' '.join(selectionSort(s2)))
if s1 == s2:
    print("Stable")
else:
    print("Not Stable")



# Example run
# Input:
-686
u]Dspi35v
# Output:
u]Dspi35v
Stable
u]Dspi35v
Stable
class card:

    def __init__(self,cv):
        c = cv[0:1]
        v = int(cv[1:2])
        self.c = c
        self.v = v
    

    def self_str(self):
        q = str(str(self.c) + str(self.v))
        return q


n = int(input())
a = list(map(card, input().split()))


b = a[:]
c = a[:]

for i in range(n):
    for j in range(n-1, i, -1):
        if b[j].v < b[j-1].v:
            b[j], b[j-1] = b[j-1],b[j]

print(" ".join(x.self_str() for x in b))

coua = ["" for i in range(10)]
coub = ["" for i in range(10)]
conb = ""
for i in range(n):
    for j in range(n):
        if i != j:
            if a[i].v == a[j].v:
                coua[a[i].v] += a[i].c
            if b[i].v == b[j].v:
                coub[b[i].v] += b[i].c
if coua == coub:
     conb = "Stable"
else:
    conb = "Not stable"
print(conb)





for i in range(n):
    mini = i
    for j in range(i, n):
        if c[j].v < c[mini].v:
            mini = j
    c[mini], c[i] = c[i], c[mini]

print(" ".join(x.self_str() for x in c))

couc = ["" for i in range(n)]
conc = ""
for i in range(n):
    for j in range(n):
        if i != j:
            if c[i].v == c[j].v:
                couc[c[i].v] += c[i].c
if coua == couc:
     conc = "Stable"
else:
    conc = "Not stable"

print(conc)

# Example run
# Input:
-3675660
187
# Output:
18
Stable
18
Not stable
n = int(input())
a = list(map(str, input().split()))
b = a.copy()


def bubble_sort():
    for i in range(n):
        for j in reversed(range(i+1, n)):
            num = int(a[j][1])
            num_ = int(a[j-1][1])
            if num < num_:
                a[j], a[j-1] = a[j-1], a[j]
    return a


def selection_sort():
    for i in range(n):
        minv = int(b[i][1])
        mink = i
        for j in range(i, n):
            if int(b[j][1]) < minv:
                minv = int(b[j][1])
                mink = j
        if int(b[i][1]) != minv:
            b[i], b[mink] = b[mink], b[i]
    return b


bubble = bubble_sort()
selection = selection_sort()


def check_stable():
    if selection == bubble:
        return 'Stable'
    else:
        return 'Not stable'


check_selection = check_stable()


print(*bubble)
print('Stable')
print(*selection)
print(check_selection)


# Example run
# Input:
-1057486868
aR[-+%E
# Output:
aR[-+%E
Stable
aR[-+%E
Stable
def bubble_sort(c, n):
    for i in range(n):
        for j in range(n-1, i, -1):
            if int(c[j][1]) < int(c[j-1][1]):
                c[j], c[j-1] = c[j-1], c[j]
    return c

def selection_sort(c, n):
    for i in range(n):
        minj = i
        for j in range(i, n):
            if int(c[j][1]) < int(c[minj][1]):
                minj = j
        c[i], c[minj] = c[minj], c[i]
    return c

def is_stable(original_list, sorted_list):
    for target in sorted_list:
        for original in original_list:
            if target[1] == original[1]:
                if target[0] != original[0]:
                    return "Not stable"
                original_list.remove(original)
                break
    return "Stable"
                
if __name__ == "__main__":
    import copy
    n = int(input())
    c = input().split()
    bubble_list = bubble_sort(copy.deepcopy(c), n)
    print(*bubble_list)
    print(is_stable(copy.deepcopy(c), bubble_list))
    selection_list = selection_sort(copy.deepcopy(c), n)
    print(*selection_list)
    print(is_stable(copy.deepcopy(c), selection_list))


# Example run
# Input:
-1
hd](
# Output:
hd](
Stable
hd](
Stable
n = int(input())
a = input().split()
b = a[:]
frag = 1
while frag:
  frag = 0
  for i in range(n - 1):
    if a[i][1] > a[i + 1][1]:
      a[i], a[i + 1] = a[i + 1], a[i]
      frag = 1
print(*a)
print("Stable")

for i in range(n - 1):
  minj = i
  for j in range(i, n):
    if b[j][1] < b[minj][1]:
      minj = j
  b[i], b[minj] = b[minj], b[i]
print(*b)
if a == b:
  print("Stable")
else:
  print("Not stable")
    
  

# Example run
# Input:
0
UMf)wY
# Output:
UMf)wY
Stable
UMf)wY
Stable
import copy
N = int(input())
lst1 = list(input().split())
lst2 = copy.copy(lst1)

def bubble_sort(lst):
    for i in range(N):
        for j in range(N-1,i,-1):
            if (int(lst[j][1]) < int(lst[j-1][1])):
                lst[j],lst[j-1] = lst[j-1],lst[j]
    return lst
    
def selection_sort(lst):
    for i in range(N):
        minj = i
        for j in range(i,N):
            if (int(lst[j][1]) < int(lst[minj][1])):
                minj = j
        lst[i],lst[minj] = lst[minj],lst[i]
    return lst

res1 = " ".join(bubble_sort(lst1))
res2 = " ".join(selection_sort(lst2))
print(res1)
print('Stable')
print(res2)
if (res1 == res2):
    print('Stable')
else:
    print('Not stable')


# Example run
# Input:
-1628416575
+CP)0CA
# Output:
+CP)0CA
Stable
+CP)0CA
Stable
# 安定なソート
import copy


def BubbleSort(C, N):
    for i in range(0, N):
        for j in range(N - 1, i, -1):
            if C[j].value < C[j - 1].value:
                C[j], C[j-1] = C[j-1], C[j]


def SelectionSort(C, N):
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if C[j].value < C[minj].value:
                minj = j
        C[i], C[minj] = C[minj], C[i]


class Card:
    value = 0
    x = ""

    def __init__(self, x):
        self.x = x
        self.value = int(x[1])


N = int(input())
C = list(map(lambda x: Card(x), input().split(" ")))

c1 = copy.copy(C)
c2 = copy.copy(C)

BubbleSort(c1, N)
SelectionSort(c2, N)
print(" ".join([x.x for x in c1]))
print("Stable")
print(" ".join([x.x for x in c2]))
isStable = True
for i in range(0, N):
    if c1[i] != c2[i]:
        isStable = False
        break
if isStable:
    print("Stable")
else:
    print("Not stable")



# Example run
# Input:
-22
-2334
# Output:
-2334
Stable
-2334
Stable
# coding: utf-8
# Here your code !

def BubbleSort(A, N):
    count = 0
    flag = 1
    while flag:
        flag = 0
        for i in range(1, N):
            if int(A[N - i][1]) < int(A[N - i - 1][1]):
                A[N - i], A[N - i - 1] = A[N - i - 1], A[N - i]
                flag = 1
    return A


def SelectionSort(C, N):
    for i in range(N):
        minj = i

        for j in range(i, N):
            if int(C[j][1]) < int(C[minj][1]):
                minj = j
        if i != minj:
            C[i], C[minj] = C[minj], C[i]
    return C


if __name__ == '__main__':
    n = int(input())
    data = input().split()
    selection = data[:]
    data = BubbleSort(data, n)
#    print(" ".join(BubbleSort(data, n)))
    print(" ".join(data))
    print("Stable")
    selection = SelectionSort(selection, n)
    print(" ".join(selection))
    if data == selection:
        print("Stable")
    else:
        print("Not stable")

# Example run
# Input:
-95071026
5T2W9E
# Output:
5T2W9E
Stable
5T2W9E
Stable
import copy

# 入力
N=int(input())
C=list(input().split())
C_value=list(int(C[n][1:])for n in range(N))

# 安定性の判定を行う関数
def isStable(In,Out,In_value):
    flag=1
    for i in range(N):
        for j in range(i+1,N):
            for a in range(N):
                for b in range(a+1,N):
                    if In_value[i]==In_value[j] and In[i]==Out[b] and In[j]==Out[a]:
                        flag=0
    if flag==1:
        return 'Stable'
    else:
        return 'Not stable'

# バブルソート用のリスト作成
Cb=copy.copy(C)
Cb_value=list(int(Cb[n][1:])for n in range(N))

# バブルソート
for i in range(N):
    for j in range(N-1,i,-1):
        if Cb_value[j]<Cb_value[j-1]:
            Cb_value[j],Cb_value[j-1]=Cb_value[j-1],Cb_value[j]
            Cb[j],Cb[j-1]=Cb[j-1],Cb[j]

# 出力
print(' '.join(Cb))
print(isStable(C,Cb,C_value))


# 選択ソート用のリスト作成
Cs=copy.copy(C)
Cs_value=list(int(Cs[n][1:])for n in range(N))

# 選択ソート
for i in range(N):
    minj=i
    for j in range(i,N):
        if Cs_value[j]<Cs_value[minj]:
            minj=j
    Cs_value[i],Cs_value[minj]=Cs_value[minj],Cs_value[i]
    Cs[i],Cs[minj]=Cs[minj],Cs[i]

# 出力
print(' '.join(Cs))
print(isStable(C,Cs,C_value))



# Example run
# Input:
0
UUuK
# Output:
UUuK
Stable
UUuK
Stable
STABLE = 'Stable'
UNSTABLE = 'Not stable'


def main():
  card_num = int(input())
  cards = input().split()

  bubble_sorted = bubble_sort(cards, card_num)
  select_sorted = select_sort(cards, card_num)

  stability = True
  for i, c in enumerate(select_sorted):
    if c != bubble_sorted[i]:
      stability = False
      break
  stability = STABLE if stability else UNSTABLE

  print(bubble_sorted)
  print(STABLE)

  print(select_sorted)
  print(stability)

  return 0


def order(card_sym):
  return int(card_sym[1])


def select_sort(elements, element_num):
  elements = list(elements)

  for i in range(0, element_num - 1):
    min_val = order(elements[i + 1])
    min_index = i + 1
    for j in range(i + 1, element_num):
      if order(elements[j]) < order(min_val):
        min_val = elements[j]
        min_index = j
    if order(elements[i]) > order(elements[min_index]):
      elements[i], elements[min_index] = elements[min_index], elements[i]

  return elements


def bubble_sort(elements, element_num):
  elements = list(elements)

  for i in range(1, element_num):
    for j in reversed(range(i, element_num)):
      if order(elements[j - 1]) > order(elements[j]):
        elements[j - 1], elements[j] = elements[j], elements[j - 1]

  return elements


if __name__ == '__main__':
  main()

# Example run
# Input:
-29792
VK$.dV
# Output:
['VK$.dV']
Stable
['VK$.dV']
Stable
class Card:
    def __init__(self, mark, value):
        self.mark = mark
        self.value = value

    def __eq__(self, other):
        return self.value == other.value and self.mark == self.mark

    def __lt__(self, other):
        return self.value < other.value

    def __str__(self):
        return self.mark + str(self.value)


def BubbleSort(arr):
    res = arr.copy()
    swap_flg = True
    i = 0
    while swap_flg:
        swap_flg = False
        for j in range(len(res) - 1, i, -1):
            if (res[j] < res[j - 1]):
                res[j], res[j - 1] = res[j - 1], res[j]
                swap_flg = True
        i += 1
    return res


def SelectionSort(arr):
    res = arr.copy()
    for i in range(0, len(res)):
        minj = i
        for j in range(i, N):
            if res[j] < res[minj]:
                minj = j
        if (i != minj):
            res[i], res[minj] = res[minj], res[i]
    return res


def isStable(in_arr, out_arr):
    stable_arr = BubbleSort(in_arr)
    return all(out_arr[i] == stable_arr[i] for i in range(0, len(out_arr)))


N = int(input())
arr = [Card(s[0], int(s[1])) for s in input().split()]
b_arr = BubbleSort(arr)
print(' '.join(map(str, b_arr)))
print('Stable' if isStable(arr, b_arr) else 'Not stable')
s_arr = SelectionSort(arr)
print(' '.join(map(str, s_arr)))
print('Stable' if isStable(arr, s_arr) else 'Not stable')



# Example run
# Input:
-2
-20635
# Output:
-2
Stable
-2
Stable
n = int(input())
a = input().split()
b = a[:]
frag = 1
while frag:
  frag = 0
  for i in range(n - 1):
    if a[i][1] > a[i + 1][1]:
      a[i], a[i + 1] = a[i + 1], a[i]
      frag = 1
print(*a)
print("Stable")

for i in range(n - 1):
  minj = i
  for j in range(i, n):
    if b[j][1] < b[minj][1]:
      minj = j
  b[i], b[minj] = b[minj], b[i]
print(*b)
if a == b:
  print("Stable")
else:
  print("Not Stable")
    
  

# Example run
# Input:
-31648906
h%q*F[Z&
# Output:
h%q*F[Z&
Stable
h%q*F[Z&
Stable
import copy
n=int(input())
num=input().split()
numa=copy.copy(num)
numb=copy.copy(num)

#buble
for i in range(0,n):
	a=0
	for j in range(n-1,i,-1):
		if numa[j]<numa[j-1]:
			a=numa[j]
			numa[j]=numa[j-1]
			numa[j-1]=a
print(' '.join(list(map(str,numa))))
print('Stable')

#select
for i in range(0,n):
	minj=i
	b=0
	for j in range(i,n):
		if numb[j]<numb[minj]:
			minj=j
	b=numb[minj]
	numb[minj]=numb[i]
	numb[i]=b
print(' '.join(list(map(str,numb))))
if numb==numa:
	print('Stable')
else:
	print('Not stable')
		



# Example run
# Input:
-514
}oE
# Output:
}oE
Stable
}oE
Stable
def bubbleSort(C1,N):
    for i in range(N):
        for j in range(N-1,i,-1):
            if C1[j][1] < C1[j-1][1]:
                C1[j],C1[j-1] = C1[j-1],C1[j]
    print(*C1)
    print("Stable")
    return C1[:]
    
def selectSort(C2,N):
    for i in range(0,N):
        minj = i
        for j in range(i,N-1):
            if C2[j][1] > C2[j+1][1]:
                minj = j+1
        C2[i],C2[minj] = C2[minj],C2[i]
    return C2[:]

N = int(input())
C1 = input().split()
C2 = C1[:]

C1 = bubbleSort(C1,N)
C2 = selectSort(C2,N)

if C1 == C2:
    print(*C2)
    print("Stable")
else:
    print(*C2)
    print("Not Stable")


# Example run
# Input:
-9179099
?5DU4-K~
# Output:
?5DU4-K~
Stable
?5DU4-K~
Stable
N = int(input())
S = list(input().split())

def bubble(S):
    sorted_l = []
    un_sorted_l = S[:]
    counter = 0
    while un_sorted_l:
        n = len(un_sorted_l)
        for i in reversed(range(1, n)):
            if un_sorted_l[i-1][1:] <= un_sorted_l[i][1:]:
                continue
            else:
                counter += 1
                un_sorted_l[i-1], un_sorted_l[i] = un_sorted_l[i], un_sorted_l[i-1]
        sorted_l.append(un_sorted_l[0])
        un_sorted_l = un_sorted_l[1:]

    return sorted_l
    
def select(S):
    selection_sort = S[:]
    counter = 0
    for i in range(len(selection_sort)):
        v = selection_sort[i]
        min_v = v
        min_i = i
        for j in range(i, len(selection_sort)):
            if min_v[1:] > selection_sort[j][1:]:
                min_v = selection_sort[j]
                min_i = j
        if v != min_v:
            counter += 1
            selection_sort[i], selection_sort[min_i] = selection_sort[min_i], selection_sort[i]
            
    return selection_sort

def check(X, S):
    d = {}
    for i, s in enumerate(S):
        d[s] = i
        
    for x, y in zip(X[:-1],X[1:]):
        if x[1:] == y[1:] and d[x] > d[y]:
            return 'Not stable'
    
    return 'Stable'
        
        

b = bubble(S)
print(' '.join(b))
print(check(b, S))

s = select(S)
print(' '.join(s))
print(check(s, S))


    


# Example run
# Input:
223
Kh]~GZXVJ
# Output:
Kh]~GZXVJ
Stable
Kh]~GZXVJ
Stable
# -*- coding: utf-8 -*-
def bubble(a):
    card = a[:]
    size = len(card)
    for i in range(size):
        for j in range(size - 1, i, -1):
            if card[j][1] < card[j - 1][1]:
                card[j], card[j - 1] = card[j - 1], card[j]
    return card


def selection(a):
    card = a[:]
    size = len(card)
    for i in range(size):
        minj = i
        for j in range(i, size):
            if card[j][1] < card[minj][1]:
                minj = j
        if minj != i:
            card[i], card[minj] = card[minj], card[i]
    return card


def is_stable(a, b):
    size = len(a)
    for i in range(size):
        if a[i][0] != b[i][0]:
            return False
    return True


def main():
    n = int(input())
    cards = input().split()
    a = bubble(cards)
    b = selection(cards)

    print(*a)
    print("Stable")
    print(*b)
    print("Stable" if is_stable(a, b) else "Not stable")


if __name__ == '__main__':
    main()



# Example run
# Input:
11762246
1p[%Ao
# Output:
1p[%Ao
Stable
1p[%Ao
Stable
class Card:
    def __init__(self,suit,value):
        self.suit=suit
        self.value=value
    def getCard(self):
        return self.suit + str(self.value)

def SelectionSort(C):
    A=C
    # sort
    for i in range(len(A)):
        mini=i
        for j in range(i,len(A)):
            if A[j].value<A[mini].value:
                mini=j
        if mini!=i:
            tmp=A[i]
            A[i]=A[mini]
            A[mini]=tmp
    return A

def BubbleSort(C):
    A=C
    for i in range(len(A)):
        for j in reversed(range(i+1,len(A))):
            if A[j].value < A[j-1].value:
                tmp=A[j]
                A[j]=A[j-1]
                A[j-1]=tmp
    return A

def getCardString(A):
    maplist=[]
    for a in A:
        maplist.append(a.getCard())
    return ' '.join(maplist)

n=int(input())
cardsA=[]
cardsB=[]
for data in input().split():
    charList=list(data)
    cardsA.append(Card(charList[0],int(charList[1])))
    cardsB.append(Card(charList[0],int(charList[1])))
bubble=getCardString(BubbleSort(cardsA))
select=getCardString(SelectionSort(cardsB))
print(bubble)
print('Stable')
print(select)
print('Stable' if select==bubble else 'Not stable')





# Example run
# Input:
277306
-8007342
# Output:
-8
Stable
-8
Stable