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.

Sulagna | 117 |

RUTVIKHARIPARA | 116 |

janvidavda105190 | 93 |

harshsiddhapura105461 | 93 |

devsinghindra | 80 |

PiyushPandey4 | 614 |

ASWATHAMA | 561 |

akhyasharma01 | 547 |

john_wick | 521 |

jagrit_07 | 443 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4598 |

Login to report an issue on this page.