Help me in solving ATTND problem

My issue

what is the solution of this code

My code

#include <stdio.h>

int main(void) {
	// your code goes here
	return 0;
}


Problem Link: ATTND Problem - CodeChef

@santosh_pandey
This is solution of mine . Applied brute force.

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    string sf[n],sl[n];
	    for(int i=0;i<n;i++)
	    {
	        cin>>sf[i]>>sl[i];
	    }
	    for(int i=0;i<n;i++)
	    {
	        int ch=0;
	        for(int j=0;j<n;j++)
	        {
	            if(i!=j)
	            {
	                if(sf[i]==sf[j])
	                {
	                    ch=1;
	                    break;
	                }
	            }
	        }
	        if(ch)
	        {
	            cout<<sf[i]<<" "<<sl[i]<<endl;
	        }
	        else
	        {
	        cout<<sf[i]<<endl;
	        }
	    }
	}
	return 0;
}