#include<bits/stdc++.h>
using namespace std;
string s,t;
int f = -1;
void toli(string &s)
{
for(int i = 0;i < s.size();i++)
{
if(s[i] <= 'Z')
s[i] += 32;
}
}
bool cmp(string s,string t)
{
if(s.size() != t.size())
return false;
for(int i = 0;i < s.size();i++)
{
if(s[i] != t[i])
return false;
}
return true;
}
int main()
{
cin >> s;
toli(s);
int i = 0;
while(cin >> t)
{
toli(t);
if(cmp(s,t))
{
if(!~f)
f = i;
i++;
}
}
if(!i)
printf("-1");
else
printf("%d %d",i,f);
return 0;
}