Option Strict On
Imports System.IO
Module Module1

    Sub Main()
        Dim input As StreamReader = New StreamReader("input.txt")
        Dim n, p As Integer
        n = Integer.Parse(input.ReadLine)
        Dim A(n - 1) As Double
        Dim line As String = input.ReadLine
        For i As Integer = 0 To (n - 1)
            p = line.IndexOf(";")
            A(i) = Integer.Parse(line.Substring(0, p))
            line = line.Substring(p + 1)
            Console.Write("{0},", A(i))
        Next i
        Console.WriteLine()
        For k = 1 To (n - 1)
            For i As Integer = 1 To 4
                If A(i) < A(i - 1) Then
                    A(i - 1) = A(i) + A(i - 1)
                    A(i) = A(i - 1) - A(i)
                    A(i - 1) = A(i - 1) - A(i)
                End If
            Next i
        Next k
        Console.WriteLine("{0},{1},{2},{3},{4}", A(0), A(1), A(2), A(3), A(4))
        Console.ReadLine()
        input.Close()
    End Sub

End Module
