After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string *s*, and she tried to remember the string *s* correctly.

However, Ciel feels *n* strings *b*<sub class="lower-index">1</sub>, *b*<sub class="lower-index">2</sub>, ... , *b*<sub class="lower-index">*n*</sub> are really boring, and unfortunately she dislikes to remember a string that contains a boring substring. To make the thing worse, what she can remember is only the contiguous substring of *s*.

Determine the longest contiguous substring of *s* that does not contain any boring string, so that she can remember the longest part of Taro's response.
In the first line there is a string *s*. The length of *s* will be between 1 and 10<sup class="upper-index">5</sup>, inclusive.

In the second line there is a single integer *n* (1 ≤ *n* ≤ 10).  Next *n* lines, there is a string *b*<sub class="lower-index">*i*</sub> (1 ≤ *i* ≤ *n*). Each length of *b*<sub class="lower-index">*i*</sub> will be between 1 and 10, inclusive.

Each character of the given strings will be either a English alphabet (both lowercase and uppercase) or a underscore ('_') or a digit. Assume that these strings are case-sensitive.
In the first sample, the solution is traight_alon.

In the second sample, the solution is an empty string, so the output can be «0 0», «0 1», «0 2», and so on.

In the third sample, the solution is either nagio or oisii.
Go_straight_along_this_street
5
str
long
tree
biginteger
ellipse
12 4
IhaveNoIdea
9
I
h
a
v
e
N
o
I
d
0 0
unagioisii
2
ioi
unagi
5 5
abcabcabcabc
3
abcabca
bcab
cabc
4 6
ThankYouForParticipatingRound71
6
ForP
oun
nkYouForP
Tha
ouForP
ound7
18 9
WishYourSolutionPassesFinalTests
10
rSoluti
inal
olutionPas
assesFin
ourSo
onP
WishYourSo
sFinalTes
hYourSolut
onPas
9 15
9
1
9
0 0
Z
1
a
1 0
12abcdefghijklmnop
10
abcd
abc
ab
a
klmn
lmn
mn
n
op
12
12 3
12abcdefghijklmnop
10
a
op
ab
abc
abcd
n
mn
12
lmn
klmn
12 3
12abcdefghijklmnop
10
lmn
abc
a
klmn
n
abcd
op
mn
ab
12
12 3
x5x5
10
x5
x5x
x5x5
x5
x5
QyBa0yZO_c
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UE
UU
YEYEUUE
YEYE
UU
EY
EYEUU
YEYEUU
iBXoTbQ7X3
4 0
wwwwDwwwwD
10
wD
Dwww
wD
Dwwww
wwwwD
Dww
wD
wwDww
wwww
wwww
3 6
4tg4ttgg47t44tg4ttgg47t4
10
47t44tg4tt
ttgg4
g4ttgg47t4
g47t44t
tg4ttg
44tg4ttg
ttgg47
t44tg
g47t44tg
4ttgg47t4
8 5
g0sg00AAA0Asggss0sAg0sg00AAA0Asggss0sA
10
Ag0sg00AAA
Asggss
sAg
Asggss0s
ggss0sAg
sAg0sg
ggss0sA
0sg00AA
AAA0A
AA0
8 18
000gooo0g0vgovvv0oggv0v0go000gooo0g0vgovvv0oggv0v0go
10
gv0v0go
0gooo0g
gooo0g0v
o000
gooo0g0v
v0go000go
go000gooo0
v0v0go00
vv
ggv0v0
10 30
B2KR
10
B2
2KR
B2KR
2K
2KR
KR
2KR
B2KR
2K
2KR
1 3
dxY_8
10
xY_8
dxY
dx
Y_
xY_
dx
xY
dx
xY_8
dxY
2 3
umi4qX
10
qX
um
4qX
qX
umi4qX
umi4
umi4
umi4q
mi4q
umi4q
3 2
4stuNRe
10
4stu
stuN
stuNRe
4stu
tuNRe
st
tuNR
4stuN
tuN
4stu
4 3
bTnstTqbTnstTq
10
bTnstTq
nstTqbT
TqbT
bTns
TqbT
Tns
TnstT
TnstTqb
nstT
stT
4 6
Oq02utSVOq02utSV
10
2utSVOq
2utSVO
02utS
SVOq0
ut
Oq
Oq
q02utSVO
Oq02utSV
VOq0
4 9
DpGGt6_wGLPDpGGt6_wGLP
10
6_wGL
GLPDpGG
t6_wG
PDpGGt6_
wGLPDpGGt6
6_
_wGL
pGGt6_
6_wGLPD
6_wGLPDpG
8 9
7QTfE4ALvzkzzD4j7QTfE4ALvzkzzD4j
10
vzkzzD4j7
E4AL
TfE4ALv
zzD4j7QT
zkzzD4j7
4AL
j7Q
E4ALvzkzzD
vzkzzD4j
4ALvzk
9 22
6CLznedj88834gqTIhMTPjm_3DbkQpuYkBvU3o55h79ntRqjHTOu3WWNNGLyQSZ_o45mK5mMtRJmWUq2twqWP10OlnDAB1EP2rG
10
834gqTI
_o4
vU3o55h79n
vLwlk3PY7Z
k8PnkBpRYB
qdkB9b_SS2
kY4mBeAdgK
b577cjQiSx
yOFiEkP1sD
oYOqd8uuTt
35 64
JroK3tfp941zeUovVIqCV7Sv2elf6TN8QRl8mhxQWgoQRXOLkcUjK29Ed2gBDR1TLdZeLUi9zJyBayrNlWgW0iPSG26DuJ9QK95
10
roK
ovVI
LUi9
LUi
TLd
elf6
9zJyBa
DR1
dZe
8mhxQWgo
27 72
p7B41t9y83IghcJG8zgWzCSATkkvQQhvqm7j_4ffUPbriGW57mbGPzqiuMEmJevfIhX2FNLFBxAGm3vLXRPOdphoWkCquDjAsW9
10
1t9y83
BxAGm3v
G8z
CSATk
cJG
IhX2FNLF
zqiuME
p7B4
kkvQ
PbriGW57m
26 73
r5oW1NW2kr193KwV_eASuj9Jq0q0Kmt2EUD1R72p2nPuxNpIqi7o_KuxldYjLJmiXj93JUxRTniFzKkXxHwXDZCzC76klFnfjAQ
10
p2nPuxN
93J
NpIqi7o_K
iXj93JUxRT
1NW2kr19
0Kmt2EUD1
TniFzKkXxH
iXj93JU
NW2kr19
3KwV_
26 73
hb
1
Aa
2 0
unagioisiiqqqqqqqqqqqq
2
ioi
unagi
17 5
abababab
3
ab
ba
a
1 7
abcdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
2
abcd
abcd
50 1
abababababababababababababababababababababababababababababab
1
a
1 59
abc
2
a
b
1 2
abcde
1
f
5 0
ahmed
5
ahmed
hmed
med
ed
d
4 0
abc
1
b
1 2
import time
 
s,data=input(),[input() for _ in range(input())]
 
cnt = 0
pos = 0
l = 0
r = 1
length = len(s)
while r <= length:
    found = False
    size = 0
    for sub in data:
        if (r - l >= len(sub)) and  (sub == s[max(l, r - len(sub)):r]):
            found = True
            size = max(len(sub),size)
            #break
    if not found:
        r+=1;
    else:
        l = r - size + 1
    if cnt < r - l - 1:
        cnt = r - l - 1
        pos = l
 
print cnt, pos
