def bubble_sort (a)

arr = a.dup
n = arr.length

for i in 0 ..n-1
j = n-1
while j = i
if arr[j-1][1] > arr [j][1]

arr[j-1],arr[i] = arr[j],arr[j-1]

end


j -=1

end

end
arr
end

gets

x = gets.split.map
b = bubble_sort(x)

puts 'stable'