import java.util.Scanner;
public class Main {
static int visited[]= {0,0,0,0,0,0,0,0,0,0,0};
static int lianxi[][]= {
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0}
};
static int p=0;
public static void main(String[] args) {
//int visited[]= {0,0,0,0,0,0,0,0,0,0};
int N,E;
Scanner scanf=new Scanner(System.in);
N=scanf.nextInt();
E=scanf.nextInt();
for(int i=0;i<E;i++) {
int x=scanf.nextInt();
int y=scanf.nextInt();
lianxi[x][y]=1;
lianxi[y][x]=1;
}
int i,j;
i=scanf.nextInt();
j=scanf.nextInt();
DFS(i,N,j);
if(p==1)
System.out.printf("There is a path between %d and %d.",i,j);
else
System.out.printf("There is no path between %d and %d.",i,j);
}
public static void DFS(int v,int n,int j) {
if(v==j) {
p=1;
return;
}
visited[v]=1;
for(int i=0;i<n;i++) {
if(visited[i]==0&&lianxi[v][i]==1) {
DFS(i, n, j);
}
}
}
}