public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(br.readLine());

			Line[] lines = new Line[n];
			for (int i = 0; i < n; i++) {
				String line = br.readLine();
				lines[i] = new Line(line.length() - 1, line);
			}

			Arrays.sort(lines);

			Line line0 = lines[0];

			while (line0.pos >= 0) {
				char x = line0.current();
				int i = 1;
				for (i = 1; i < n; i++) {
					char y = lines[i].current();
					if (x != y) {
						break;
					}
					lines[i].pos -= 1;
				}
				if (i < n) {
					break;
				}
				line0.pos -= 1;
			}

			if (line0.pos + 1 < line0.line.length()) {
				System.out.println(line0.line.substring(line0.pos + 1));
			} else {
				System.out.println("nai");
			}

		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}