Once, a genius guy Cristo visited NASA where he met many scientists. A young intern Mark at NASA asked Cristo to observe the strange behaviour of two

independent particles (say Alpha and Beta) moving in the free space.Cristo was astonished to see the movement of Alpha and Beta. However, he formulated a procedure

to evaluate the distance covered by the particles in given time.
The procedure calculates the distance covered by Alpha and Beta for a given time. Mark, however struggles

to evaluate the procedure manually and asks you to help him. 
Cristo's Procedure :- 
alpha = 0
beta = 0
Procedure CristoSutra( Ti ) :
if Ti <= 0 :
alpha = alpha + 1 
else if Ti == 1 :
	beta = beta + 1
else :
CristoSutra(Ti-1)
	         CristoSutra(Ti-2)
	         CristoSutra(Ti-3)
end procedure
Note: Print the answer by taking mod from 109+7 .

-----Constraints:-----
- 1<=T<=105
- 1<=Ti<=105

-----Input Format:-----
First line consists an integer t, number of Test cases.For each test case, there is an integer denoting time Ti.

-----Output Format:-----
For each test case, a single output line contains two space seperated numbers ,distance covered by alpha and beta in the given time.

-----Subtasks:-----
Subtask 1 (30 points)
- 1<=T<=10
- 1<=Ti<=1000
Subtask 2 (70 points)
original contraints
Sample Input:
2
1
2
Sample Output:
0 1
2 1

Starter code:

Solutions:
for _ in range(eval(input())):
 n=eval(input())
 mod=1000000007
 f1,f2=[0]*101000,[0]*101000
 f1[1]=0
 f1[2]=2
 f1[3]=3
 f2[1]=1
 f2[2]=1
 f2[3]=2;
 for i in range(4,100001):
  f1[i]=f1[i-1]%mod+f1[i-2]%mod+f1[i-3]%mod
  f2[i]=f2[i-1]%mod+f2[i-2]%mod+f2[i-3]%mod
 print(f1[n]%mod,f2[n]%mod) 

MOD = 10**9+7
lst = [(1,0),(0,1),(2,1),(3,2)]
for t in range(int(input())):
 n = int(input())
 l = len(lst)
 while (n >= l):
  a = (lst[-1][0]+lst[-2][0]+lst[-3][0])%MOD
  b = (lst[-1][1]+lst[-2][1]+lst[-3][1])%MOD
  lst.append((a,b))
  l+=1
 print(lst[n][0],lst[n][1])

a, b = [0]*101001, [0]*101001
mod = pow(10,9)+7
a[0]=1
b[0]=0

a[1]=0
b[1]=1

b[2] = b[1] + b[0] + b[0]
a[2] = a[1] + a[0] + a[0]

for u in range( 3, 100001 ) :
 b[u] += (b[u-1] + b[u-2] + b[u-3])%mod
 a[u] += (a[u-1] + a[u-2] + a[u-3])%mod

for t in range (eval(input())) :
 x = eval(input())
 print(a[x], b[x])


a=[]
mod=1000000007
a.append([])
a[0].append(0)
a[0].append(1)
a.append([])
a[1].append(2)
a[1].append(1)
a.append([])
a[2].append(3)
a[2].append(2)
for i in range(3,100001):
 a.append([])
 a[i].append((a[i-1][0]+a[i-2][0]+a[i-3][0])%mod)
 a[i].append((a[i-1][1]+a[i-2][1]+a[i-3][1])%mod)
t=eval(input())
while t:
 n=eval(input())
 print(a[n-1][0]%mod,a[n-1][1]%mod)
 t-=1


a=[]
a.append([])
a[0].append(0)
a[0].append(1)
a.append([])
a[1].append(2)
a[1].append(1)
a.append([])
a[2].append(3)
a[2].append(2)
for i in range(3,100001):
 a.append([])
 a[i].append((a[i-1][0]+a[i-2][0]+a[i-3][0])%1000000007)
 a[i].append((a[i-1][1]+a[i-2][1]+a[i-3][1])%1000000007)
t=eval(input())
while t:
 n=eval(input())
 print(a[n-1][0],a[n-1][1])
 t-=1


z,a,b=(10**9+7),[0]*100007,[0]*100007
b[0],b[1],a[2]=1,1,1
for i in range(3,100007):
 a[i]=a[i-1]+a[i-2]+a[i-3]
 b[i]=b[i-1]+b[i-2]+b[i-3]
for _ in range(0,int(input())):
 inp=int(input())+1
 print(b[inp]%z,a[inp]%z)

lim=100007
z=(10**9+7)
a=[0]*lim
a[2]=1
for i in range(3,lim):
 a[i]=a[i-1]+a[i-2]+a[i-3]
b=[0]*lim
b[1]=1
b[0]=1
for i in range(3,lim):
 b[i]=b[i-1]+b[i-2]+b[i-3]
 
for _ in range(0,int(input())):
 inp=int(input())
 print(b[inp+1]%z,a[inp+1]%z)


lim=1002
z=(10**9+7)
a=[0]*lim
a[2]=1
for i in range(3,lim):
 a[i]=a[i-1]+a[i-2]+a[i-3]
b=[0]*lim
b[1]=1
b[0]=1
for i in range(3,lim):
 b[i]=b[i-1]+b[i-2]+b[i-3]
 
for _ in range(0,int(input())):
 inp=int(input())
 print(b[inp+1]%z,a[inp+1]%z)