using System;

namespace MyCompiler {
    class Program {
        public static void Main(string[] args) {
            int T = Convert.ToInt32(Console.ReadLine());  
                for (int casos=0; casos < T; casos++) {
                    int N = Convert.ToInt32(Console.ReadLine());
                    string [] cadena = Console.ReadLine().Split(' ');
                    int [] adultos = new int[N/2];
                    int [] terceraedad = new int[N/2];
                    int [] Fichos = new int[N];
                    int k=0,j=0;
                    for (int i=0; i < N; i++) {
                        Fichos[i] = Convert.ToInt32(cadena[i]);
                        if (Fichos[i] < 0 ){
                             terceraedad[j] = Fichos[i];
                             j++;
                        }
                        else{
                            adultos[k] = Fichos[i];
                            k++;
                        }
                    }
                    for(int i = 0; i < adultos.Length; i++ ){
                      Console.Write("{0} {1} ",adultos[i],terceraedad[i]);
                    }
                    Console.Write("\n");
                }
            }
        }
    }

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: