Template in C++ is a feature. We write code once and use it for any data type including user defined data types.

Given three cases :

1st case when two strings are given , print the smallest of the two strings.

2nd case when two integers are given, print the smallest of the two integers.

3rd case when two char are given , print the smallest of the two characters(lowercase).

Your task is to complete class minElement which would include a private variable say y, a constructor which would set the given value to the private variable. And a method check() which would take one parameter say x and print the min of x and y(private variable) .

**Input: **

The first line will contain an integer **T **(number of test cases). First line of each test case will contain 1 integer **c. **Next line will contain two strings if c is equal to 1 or will contain two integers if c is equal to 2 or will contain two char if value of c is equal to 3.

**Output: **

Print the lowest of the two values given.

**Constraints: **

1 < = **T** < = 100

1 < = **c** < = 3

1<= Length of strings, integers<=10^{3}

**Example:
Input:**

3

1

gfg spl

2

5 9

3

p s

**Output:**

gfg

5

p

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

agness | 122 |

aman1931998 | 102 |

Survivor | 100 |

uchitnitk | 96 |

lonecoder | 95 |

KshatriyaYash | 1066 |

nikhil_sojan | 1032 |

lonecoder | 1030 |

mazumderrohit8 | 899 |

SumitSingh27 | 832 |

blackshadows | 5327 |

Ibrahim Nash | 5215 |

akhayrutdinov | 5111 |

mb1973 | 4492 |

Quandray | 4444 |

Login to report an issue on this page.