#include <stdio.h>

#define TRUE 1
#define FALSE 0

int encaixa(int a, int b);
int eh_segmento(int a, int b);

int main()
{
  int a, b, t;

  scanf("%d %d", &a, &b);

  if (a > b)
    { t = a; a = b; b = t; }
  
  if (eh_segmento(a, b))
    printf("%d 'e segmento de %d\n", a, b);
  else   
    printf("%d nao 'e segmento de %d\n", a, b);\

  return 0;
}

int encaixa(int a, int b)
{
  int p=1, aa = a;

  while (aa > 0) 
    { p *= 10; aa /= 10; }

  return b % p == a;
}

int eh_segmento(int a, int b)
{
  while (b >= a) {
    if (encaixa(a, b))
      return TRUE;
    b /= 10;
  }

  return FALSE;
}


