7458: Tokitsukaze, CSL and Palindrome Game

内存限制:128 MB 时间限制:6 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:0 通过:0

题目描述

Tokitsukaze is playing with CSL a game based on a string S1..nwhich only contains lowercase letters and whose length is n.
A string is palindromic if and only if it reads the same backward as forward, such as "madam" and "racecar". Before the game starts, Tokitsukaze will select a palindromic substring of S, denoted as Sa..b, and CSL will select a palindromic substring, denoted as Sc..d, too.
There is also a string Pthat is empty at the beginning of the game. Then at every second, a character will be appended to the end of Pautomatically, where the character is randomly chosen from all possible lowercase letters (i.e. 'a' to 'z'), each with the same probability 126. The game ends when both Sa..band Sc..dbecome substrings of P.
Let E(Sa..b)be the expected length of Pwhen Sa..bfirstly becomes a substring of P, and E(Sc..d)be the similar expected value for Sc..d. The winner of the game will be the one with a lower expected value for his or her choice. In case of a tie, when E(Sa..b)equals to E(Sc..d), the game is a draw.
Now, they will play this game with the same string Sfor qtimes, and Tokitsukaze will inform you of their choices in each game. Can you predict for her the result of each game?

输入格式

There are several test cases.
The first line contains an integer T(1≤T≤25), denoting the number of test cases. Then follow all the test cases.
For each test case, the first line contains an integer n(1≤n≤105), denoting the length of the string S.
The second line contains the string Sconsisting of only lowercase letters.
The third line contains an integer q(1≤q≤105), denoting the number of games.
In the next qlines, each line contains four integers a, b, cand d(1≤a≤b≤n,1≤c≤d≤n), representing a game where Tokitsukaze selects Sa..band CSL selects Sc..d.

输出格式

For each game, output in one line "sjfnb" (without quotes, the same below) if Tokitsukaze will be the winner, or "cslnb" if CSL will, or "draw" in case of a tie. Note that the output characters are case-sensitive.

输入样例 复制

1
7
abbabba
5
1 1 2 2
1 4 4 7
2 3 1 7
1 4 5 6
2 3 3 5

输出样例 复制

draw
draw
sjfnb
cslnb
sjfnb