#include<stdio.h>
#include<stdio.h>
int main(){
    int num1, num2;
    scanf("%d %d", &num1, &num2);
    bool digits1[10] = {false};
    bool digits2[10] = {false};
    if(num1 == 0){
    digits1[10] = true;    
    }
    if(num2 == 0){
    digits2[10] = true;    
    }
    int temp1 = num1;
    while(temp1 > 0){
        digits1[temp1 % 10] = true;
        temp1 /= 10;
    }
     int temp2 = num2;
    while(temp2 > 0){
        digits2[temp1 % 10] = true;
        temp2 /= 10;
    }
    bool found_common = false;
    for(int i = 0; i < 10; i++){
        if(digits1[i] && digits2[i]){
            printf("%d ", i);
            found_common = true;
        }
    }
    if (!found_common){
        printf("No common elements");
    }
    printf("\n");
    return 0;
}
    }