KillCode is trying to learn strings but failing to solve the recursive approach given by his Teacher. His Teacher gave him a string consisting of lower case alphabetes only , He asked to find a substring in the given string after removing any charaters from the original string . For example if the string is
" Cypher"
and the substring is "yer", Killcode can remove p,h from the string and can form the given substring.
Now the Teacher got impressed from Killcode and decided to increase the difficulty by asking to find the substring and reverse of substring in given string. If both substring can be formed by a given string by removing certain characters , print "GOOD STRING " else print "BAD STRING".
Contraints
1<=t<=10 1<=|s|<=100000
Input -
First line contains integer t denoting the test cases, each test case contains two lines containing two strings.
Output-
Print "GOOD STRING"(without quotes) both strings can be formed by given string else print "BAD STRING".
Test case 1: "abta" is given string and "aba" is given substring , now Killcode will remove 't' from given string and will get both substring and reverse of sub-string.
Test case 2: Killcode cannot find the substring and reverse of of sub-string after removing any charaters.