#include<stdio.h>
int main()
{
int a[6];
int b[6];
int p=0;
for(int i=0;i<6;i++)
{
scanf("%d",&a[i]);
scanf("%d",&b[i]);
}
for(int i=0;i<6;i++)
{
for(int j=1;j<7;j++)
{
if(a[i]==b[j])
{
p++;
}
else if(a[i+1]==b[j])
{
p++;
if(p==6)
{
printf("2");
}
}
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: