#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char* lomgestCommonPrefix(char** strs, int strsSize){
    if (strsSize == 0){
        char* empty = (char*)malloc(sizeof(char));
        *empty = '\0';
        return empty;
    }
    char* Prefix = strs[0];
    for (int i = i < strsSize; i++){
        while (strstr(strs[i], Ptrfix) != strs[i]){
            Prefix[strlen(Prefix) - 1] = '\0';
            if (strlen(Prefix) == 0){
                return Prefix;
            }
        }
    }
    return Prefix;
}
int main(){
    int N;
    scanf("%d", &N);
    char** strings = (char**)malloc(N * sizeof(char*));
    for(int i = 0; i < N; i++){
        strings[i] = (char*)malloc(101 * sizeof(char));
        scanf("%s", strings[i]);
    }
    char* lcp = longestCommonPrefix(strings, N);
    printf("%s\n", lcp);
    for(int i = 0; i < N; i++){
    }
        free(strings[i]);
        return 0;
        
    
}