Killjee And His First Approximation Problem

5

1 votes
Very-Easy
Problem

Killjee is very sad after the mishap of Code-To-Learn 1.4 and is determined to make this Algo cup a success and hence, he has framed a approximation problem for you guys.

You will be given a set of n points every point has a name. The name of each node is a smallcase alphabet character.

Killjee ask you to make a tree which has maximum number of palindromic path.

A path from u to v is defined as palindromic if word formed by the names of nodes in the path from u to v is a palindrome.

INPUT

First line of input contains a single integer n denoting number of points.

Next line contains n space separated smallcase alphabet character where ith character is name of ith node.

OUTPUT

Output n1 lines where each line contain two integers u and v, denoting there is a edge between u and V

Test Case Generation

Test cases are generated randomly.

40 % of test data has n100and name of the nodes are single character smallcase alphabets.

60 % of test data has n2000and name of the nodes are single character smallcase alphabets.

SCORING

Score for your program will be number of Palindromic path in the tree constructed by the tree generated by you.

The total points you will get in this problem is relative to the score of best solution.

You will get a wrong answer verdict if your output doesn't make a tree.

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?