using System.Collections.Generic;
public static void Main()
var names = Console.ReadLine().Split(',').ToList();
var command = Console.ReadLine();
if (command == "Add student")
names.Add(Console.ReadLine());
else if (command == "Add student on position")
var newS = Console.ReadLine();
var pos = int.Parse(Console.ReadLine());
else if (command == "Remove student on position")
names.RemoveAt(int.Parse(Console.ReadLine()));
else if (command == "Remove last student")
var lastname = names.Last();
else if (command == "Remove first student")
var firstname = names.First();
else if (command == "END")
Console.WriteLine(String.Join(" ", names));