import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class CodeC
{
	static class Scanner
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		public String nextLine()
		{
			try
			{
				return br.readLine();
			}
			catch(Exception e)
			{
				throw(new RuntimeException());
			}
		}

		public String next()
		{
			while(!st.hasMoreTokens())
			{
				String l = nextLine();
				if(l == null)
					return null;
				st = new StringTokenizer(l);
			}
			return st.nextToken();
		}

		public int nextInt()
		{
			return Integer.parseInt(next());
		}

		public long nextLong()
		{
			return Long.parseLong(next());
		}

		public double nextDouble()
		{
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n)
		{
			int[] res = new int[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextInt();
			return res;
		}

		public long[] nextLongArray(int n)
		{
			long[] res = new long[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextLong();
			return res;
		}

		public double[] nextDoubleArray(int n)
		{
			double[] res = new double[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextDouble();
			return res;
		}
		public void sortIntArray(int[] array)
		{
			Integer[] vals = new Integer[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortLongArray(long[] array)
		{
			Long[] vals = new Long[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortDoubleArray(double[] array)
		{
			Double[] vals = new Double[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public String[] nextStringArray(int n)
		{
			String[] vals = new String[n];
			for(int i = 0; i < n; i++)
				vals[i] = next();
			return vals;
		}

		Integer nextInteger()
		{
			String s = next();
			if(s == null)
				return null;
			return Integer.parseInt(s);
		}

		int[][] nextIntMatrix(int n, int m)
		{
			int[][] ans = new int[n][];
			for(int i = 0; i < n; i++)
				ans[i] = nextIntArray(m);
			return ans;
		}
	}

	static String[] normal = new String[]{"yycc", "aabb", "yddy", "yzzy"};
	static String[] normalE = new String[]{"yyc", "aab", "ydd", "yzz"};
	static String[][] diferente = new String[][]{{"ce", "be", "gg", "hh"}, {"cff", "bee", "ggh", "iih"}, {"ceeg", "bffg", "hhii", "jjkk"}};

	public static void main(String[] args)
	{
		Scanner sc = new Scanner();
		int n = sc.nextInt();
		int mod = n % 4;
		StringBuilder[] sbs = new StringBuilder[4];
		for(int i = 0; i < 4; i++) sbs[i] = new StringBuilder();
		if(n == 1)
		{
			System.out.println("a");
			System.out.println("a");
			System.out.println("b");
			System.out.println("b");
		}
		else if(n == 2)
		{

			System.out.println("aa");
			System.out.println("bb");
			System.out.println("cc");
			System.out.println("dd");
		}
		else if(n == 3)
		{
			System.out.println("abb");
			System.out.println("acc");
			System.out.println("dde");
			System.out.println("ffe");
		}
		else
		{
			while(n >= 8)
			{
				for(int i = 0; i < 4; i++) sbs[i].append(normal[i]);
				n -= 4;
			}
			if(n == 4)
				for(int i = 0; i < 4; i++) sbs[i].append(normal[i]);
			else
			{
				if(n == 5)
				{
					for(int i = 0; i < 4; i++) sbs[i].append(normalE[i]);
					for(int i = 0; i < 4; i++) sbs[i].append(diferente[0][i]);
				}
				else if(n == 6)
				{
					for(int i = 0; i < 4; i++) sbs[i].append(normalE[i]);
					for(int i = 0; i < 4; i++) sbs[i].append(diferente[1][i]);
				}
				else
				{
					for(int i = 0; i < 4; i++) sbs[i].append(normalE[i]);
					for(int i = 0; i < 4; i++) sbs[i].append(diferente[2][i]);
				}
			}
			for(StringBuilder sb : sbs)
				System.out.println(sb.toString());
		}
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class CodeC
{
	static class Scanner
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		public String nextLine()
		{
			try
			{
				return br.readLine();
			}
			catch(Exception e)
			{
				throw(new RuntimeException());
			}
		}

		public String next()
		{
			while(!st.hasMoreTokens())
			{
				String l = nextLine();
				if(l == null)
					return null;
				st = new StringTokenizer(l);
			}
			return st.nextToken();
		}

		public int nextInt()
		{
			return Integer.parseInt(next());
		}

		public long nextLong()
		{
			return Long.parseLong(next());
		}

		public double nextDouble()
		{
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n)
		{
			int[] res = new int[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextInt();
			return res;
		}

		public long[] nextLongArray(int n)
		{
			long[] res = new long[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextLong();
			return res;
		}

		public double[] nextDoubleArray(int n)
		{
			double[] res = new double[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextDouble();
			return res;
		}
		public void sortIntArray(int[] array)
		{
			Integer[] vals = new Integer[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortLongArray(long[] array)
		{
			Long[] vals = new Long[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortDoubleArray(double[] array)
		{
			Double[] vals = new Double[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public String[] nextStringArray(int n)
		{
			String[] vals = new String[n];
			for(int i = 0; i < n; i++)
				vals[i] = next();
			return vals;
		}

		Integer nextInteger()
		{
			String s = next();
			if(s == null)
				return null;
			return Integer.parseInt(s);
		}

		int[][] nextIntMatrix(int n, int m)
		{
			int[][] ans = new int[n][];
			for(int i = 0; i < n; i++)
				ans[i] = nextIntArray(m);
			return ans;
		}
	}

	public static void main(String[] args)
	{
		Scanner sc = new Scanner();
		int n = sc.nextInt();
		int mod = n % 4;
		StringBuilder[] sbs = new StringBuilder[4];
		for(int i = 0; i < 4; i++) sbs[i] = new StringBuilder();
		if(n == 1)
		{
			System.out.println("a");
			System.out.println("a");
			System.out.println("b");
			System.out.println("b");
		}
		else if(n == 2)
		{

			System.out.println("aa");
			System.out.println("bb");
			System.out.println("cc");
			System.out.println("dd");
		}
		else if(n == 3)
		{
			System.out.println("abb");
			System.out.println("acc");
			System.out.println("dde");
			System.out.println("ffe");
		}
		else
		{
			for(int i = 0; i < n; i++)
				System.out.print("aabb".charAt(i % 4));
			System.out.println();
			for(int i = 0; i < n - 1; i++)
				System.out.print("ccdd".charAt(i % 4));
			if(n % 2 == 0)
				System.out.println("ccdd".charAt((n - 1) % 4));
			else
				System.out.println("aabb".charAt((n - 1) % 4));
			System.out.print("x");
			n--;
			for(int i = 0; i < n; i++)
				System.out.print("aabb".charAt(i % 4));
			System.out.println();
			System.out.print("x");
			for(int i = 0; i < n - 1; i++)
				System.out.print("ccdd".charAt(i % 4));
			if(n % 2 == 0)
				System.out.println("ccdd".charAt((n - 1) % 4));
			else
				System.out.println("aabb".charAt((n - 1) % 4));
		}
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class CodeC
{
	static class Scanner
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		public String nextLine()
		{
			try
			{
				return br.readLine();
			}
			catch(Exception e)
			{
				throw(new RuntimeException());
			}
		}

		public String next()
		{
			while(!st.hasMoreTokens())
			{
				String l = nextLine();
				if(l == null)
					return null;
				st = new StringTokenizer(l);
			}
			return st.nextToken();
		}

		public int nextInt()
		{
			return Integer.parseInt(next());
		}

		public long nextLong()
		{
			return Long.parseLong(next());
		}

		public double nextDouble()
		{
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n)
		{
			int[] res = new int[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextInt();
			return res;
		}

		public long[] nextLongArray(int n)
		{
			long[] res = new long[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextLong();
			return res;
		}

		public double[] nextDoubleArray(int n)
		{
			double[] res = new double[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextDouble();
			return res;
		}
		public void sortIntArray(int[] array)
		{
			Integer[] vals = new Integer[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortLongArray(long[] array)
		{
			Long[] vals = new Long[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortDoubleArray(double[] array)
		{
			Double[] vals = new Double[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public String[] nextStringArray(int n)
		{
			String[] vals = new String[n];
			for(int i = 0; i < n; i++)
				vals[i] = next();
			return vals;
		}

		Integer nextInteger()
		{
			String s = next();
			if(s == null)
				return null;
			return Integer.parseInt(s);
		}

		int[][] nextIntMatrix(int n, int m)
		{
			int[][] ans = new int[n][];
			for(int i = 0; i < n; i++)
				ans[i] = nextIntArray(m);
			return ans;
		}
	}

	public static void main(String[] args)
	{
		Scanner sc = new Scanner();
		int n = sc.nextInt();
		int mod = n % 4;
		StringBuilder[] sbs = new StringBuilder[4];
		for(int i = 0; i < 4; i++) sbs[i] = new StringBuilder();
		if(n == 1)
		{
			System.out.println("a");
			System.out.println("a");
			System.out.println("b");
			System.out.println("b");
		}
		else if(n == 2)
		{

			System.out.println("aa");
			System.out.println("bb");
			System.out.println("cc");
			System.out.println("dd");
		}
		else if(n == 3)
		{
			System.out.println("abb");
			System.out.println("acc");
			System.out.println("dde");
			System.out.println("ffe");
		}
		else
		{
			for(int i = 0; i < n; i++)
				System.out.print("aabb".charAt(i % 4));
			System.out.println();
			for(int i = 0; i < n - 1; i++)
				System.out.print("ccdd".charAt(i % 4));
			if(n % 2 == 0)
				System.out.println("d");
			else
				System.out.println("aabb".charAt((n - 1) % 4));
			System.out.print("x");
			n--;
			for(int i = 0; i < n; i++)
				System.out.print("aabb".charAt(i % 4));
			System.out.println();
			System.out.print("x");
			for(int i = 0; i < n - 1; i++)
				System.out.print("ccdd".charAt(i % 4));
			if(n % 2 == 0)
				System.out.println("d");
			else
				System.out.println("aabb".charAt((n - 1) % 4));
		}
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class CodeC
{
	static class Scanner
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		public String nextLine()
		{
			try
			{
				return br.readLine();
			}
			catch(Exception e)
			{
				throw(new RuntimeException());
			}
		}

		public String next()
		{
			while(!st.hasMoreTokens())
			{
				String l = nextLine();
				if(l == null)
					return null;
				st = new StringTokenizer(l);
			}
			return st.nextToken();
		}

		public int nextInt()
		{
			return Integer.parseInt(next());
		}

		public long nextLong()
		{
			return Long.parseLong(next());
		}

		public double nextDouble()
		{
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n)
		{
			int[] res = new int[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextInt();
			return res;
		}

		public long[] nextLongArray(int n)
		{
			long[] res = new long[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextLong();
			return res;
		}

		public double[] nextDoubleArray(int n)
		{
			double[] res = new double[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextDouble();
			return res;
		}
		public void sortIntArray(int[] array)
		{
			Integer[] vals = new Integer[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortLongArray(long[] array)
		{
			Long[] vals = new Long[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortDoubleArray(double[] array)
		{
			Double[] vals = new Double[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public String[] nextStringArray(int n)
		{
			String[] vals = new String[n];
			for(int i = 0; i < n; i++)
				vals[i] = next();
			return vals;
		}

		Integer nextInteger()
		{
			String s = next();
			if(s == null)
				return null;
			return Integer.parseInt(s);
		}

		int[][] nextIntMatrix(int n, int m)
		{
			int[][] ans = new int[n][];
			for(int i = 0; i < n; i++)
				ans[i] = nextIntArray(m);
			return ans;
		}
	}

	static String[] normal = new String[]{"yycc", "aabb", "yddy", "yzzy"};
	static String[] normalE = new String[]{"yyc", "aab", "ydd", "yzz"};
	static String[][] diferente = new String[][]{{"ce", "be", "gg", "hh"}, {"cff", "bee", "ggh", "iih"}, {"ceeg", "bffg", "hhii", "jjkk"}};

	public static void main(String[] args)
	{
		Scanner sc = new Scanner();
		int n = sc.nextInt();
		int mod = n % 4;
		StringBuilder[] sbs = new StringBuilder[4];
		for(int i = 0; i < 4; i++) sbs[i] = new StringBuilder();
		while(n >= 8)
		{
			for(int i = 0; i < 4; i++) sbs[i].append(normal[i]);
			n -= 4;
		}
		if(n == 4)
			for(int i = 0; i < 4; i++) sbs[i].append(normal[i]);
		else
		{
			if(n == 5)
			{
				for(int i = 0; i < 4; i++) sbs[i].append(normalE[i]);
				for(int i = 0; i < 4; i++) sbs[i].append(diferente[0][i]);
			}
			else if(n == 6)
			{
				for(int i = 0; i < 4; i++) sbs[i].append(normalE[i]);
				for(int i = 0; i < 4; i++) sbs[i].append(diferente[1][i]);
			}
			else
			{
				for(int i = 0; i < 4; i++) sbs[i].append(normalE[i]);
				for(int i = 0; i < 4; i++) sbs[i].append(diferente[2][i]);
			}
		}
		for(StringBuilder sb : sbs)
			System.out.println(sb.toString());
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class CodeC
{
	static class Scanner
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		public String nextLine()
		{
			try
			{
				return br.readLine();
			}
			catch(Exception e)
			{
				throw(new RuntimeException());
			}
		}

		public String next()
		{
			while(!st.hasMoreTokens())
			{
				String l = nextLine();
				if(l == null)
					return null;
				st = new StringTokenizer(l);
			}
			return st.nextToken();
		}

		public int nextInt()
		{
			return Integer.parseInt(next());
		}

		public long nextLong()
		{
			return Long.parseLong(next());
		}

		public double nextDouble()
		{
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n)
		{
			int[] res = new int[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextInt();
			return res;
		}

		public long[] nextLongArray(int n)
		{
			long[] res = new long[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextLong();
			return res;
		}

		public double[] nextDoubleArray(int n)
		{
			double[] res = new double[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextDouble();
			return res;
		}
		public void sortIntArray(int[] array)
		{
			Integer[] vals = new Integer[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortLongArray(long[] array)
		{
			Long[] vals = new Long[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortDoubleArray(double[] array)
		{
			Double[] vals = new Double[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public String[] nextStringArray(int n)
		{
			String[] vals = new String[n];
			for(int i = 0; i < n; i++)
				vals[i] = next();
			return vals;
		}

		Integer nextInteger()
		{
			String s = next();
			if(s == null)
				return null;
			return Integer.parseInt(s);
		}

		int[][] nextIntMatrix(int n, int m)
		{
			int[][] ans = new int[n][];
			for(int i = 0; i < n; i++)
				ans[i] = nextIntArray(m);
			return ans;
		}
	}

	static String[] normal = new String[]{"yycc", "aabb", "bddy", "bzzy"};
	static String[] normalE = new String[]{"yyc", "aab", "ydd", "yzz"};
	static String[][] diferente = new String[][]{{"ce", "be", "gg", "hh"}, {"cff", "bee", "ggh", "iih"}, {"ceeg", "bffg", "hhii", "jjkk"}};

	public static void main(String[] args)
	{
		Scanner sc = new Scanner();
		int n = sc.nextInt();
		int mod = n % 4;
		StringBuilder[] sbs = new StringBuilder[4];
		for(int i = 0; i < 4; i++) sbs[i] = new StringBuilder();
		if(n == 1)
		{
			System.out.println("a");
			System.out.println("a");
			System.out.println("b");
			System.out.println("b");
		}
		else if(n == 2)
		{

			System.out.println("aa");
			System.out.println("bb");
			System.out.println("cc");
			System.out.println("dd");
		}
		else if(n == 3)
		{
			System.out.println("abb");
			System.out.println("acc");
			System.out.println("dde");
			System.out.println("ffe");
		}
		else
		{
			while(n >= 8)
			{
				for(int i = 0; i < 4; i++) sbs[i].append(normal[i]);
				n -= 4;
			}
			if(n == 4)
				for(int i = 0; i < 4; i++) sbs[i].append(normal[i]);
			else
			{
				if(n == 5)
				{
					for(int i = 0; i < 4; i++) sbs[i].append(normalE[i]);
					for(int i = 0; i < 4; i++) sbs[i].append(diferente[0][i]);
				}
				else if(n == 6)
				{
					for(int i = 0; i < 4; i++) sbs[i].append(normalE[i]);
					for(int i = 0; i < 4; i++) sbs[i].append(diferente[1][i]);
				}
				else
				{
					for(int i = 0; i < 4; i++) sbs[i].append(normalE[i]);
					for(int i = 0; i < 4; i++) sbs[i].append(diferente[2][i]);
				}
			}
			for(StringBuilder sb : sbs)
				System.out.println(sb.toString());
		}
	}
}


public class Do {
    public static void main(String[] args) {
        int n = new java.util.Scanner(System.in).nextInt();
        for (int i = 0; i < 4; ++i) {
            int c = (i / 2 == 0) ? 0 + i % 2 : 13;
            for (int j = (i / 2); j < (n + (i / 2)); ++j) {
                if (i == 1 && n % 2 == 1 && j == n - 1)
                    c -= 1;
                if (i == 3 && n % 2 == 0 && j == n)
                    c -= 1;
                for (; c < 0; c += 26)
                    ;
                System.out.print((char) ('a' + c));
                if (i / 2 == 1 && j == 1)
                    c += i - 1;
                else if (j % 2 == 1)
                    c = (c + 2) % 26;
            }
            System.out.println();
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Domino2 {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(f.readLine());
        int[][] a = new int[4][n];
        int x = 0;
        for (int i = 0; i < n-1; i++)
            for (int j = 0; j < 2; j++) {
                int k = i%2==0?0:2;
                a[j+k][i] = a[j+k][i+1] = x++;
                if (x == 6)
                    x = 0;
            }
        a[2][0] = a[3][0] = 6;
        int k = n%2==0?2:0;
        a[k][n-1] = a[k+1][n-1] = 7;
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < n; j++)
                System.out.print((char)('a'+a[i][j]));
            System.out.println();
        }
    }
}


import java.util.*;
public class P085A {
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);

		int N = in.nextInt();

		for (int i = 0; i < 4; ++i)
		{
			int c = (i/2 == 0) ? 0 + i%2 : 13;

			for (int j = (i/2); j < (N + (i/2)); ++j)
			{
				if (i == 1 && N%2 == 1 && j == N-1) c -= 1;
				if (i == 3 && N%2 == 0 && j == N) c -= 1;
				while (c < 0) c += 26;

				System.out.print((char)('a' + c));

				if (i/2 == 1 && j == 1) c += i - 1;
				else if (j%2 == 1) c = (c+2)%26;
			}
			System.out.println();
		}
	}
}


//package codeforces;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.StreamTokenizer;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Codeforces {

    public void solve() throws IOException {
        MyScanner sc = new MyScanner(System.in);
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            if (n % 2 == 1 && i == n - 1) {
                System.out.print('z');
            } else {
                if (i % 4 == 0 || i % 4 == 1) {
                    System.out.print('a');
                } else {
                    System.out.print('b');
                }
            }
        }
        System.out.println();
        for (int i = 0; i < n; i++) {
            if (n % 2 == 1 && i == n - 1) {
                System.out.print('z');
            } else {
                if (i % 4 == 0 || i % 4 == 1) {
                    System.out.print('c');
                } else {
                    System.out.print('d');
                }
            }
        }
        System.out.println();
        for (int i = 0; i < n; i++) {
            if (i == 0) {
                System.out.print('x');
            } else {
                if (n % 2 == 0 && i == n - 1) {
                    System.out.print('y');
                } else {
                    if (i % 4 == 1 || i % 4 == 2) {
                        System.out.print('a');
                    } else {
                        System.out.print('b');
                    }
                }
            }
        }
        System.out.println();
        for (int i = 0; i < n; i++) {
            if (i == 0) {
                System.out.print('x');
            } else {
                if (n % 2 == 0 && i == n - 1) {
                    System.out.print('y');
                } else {
                    if (i % 4 == 1 || i % 4 == 2) {
                        System.out.print('c');
                    } else {
                        System.out.print('d');
                    }
                }
            }
        }
    }

    public static void main(String[] args) throws IOException {
        Codeforces cf = new Codeforces();
        cf.solve();
    }
}

class MyScanner {

    private StreamTokenizer st;

    public MyScanner(InputStream is) {
        st = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));
    }

    public int nextInt() throws IOException {
        st.nextToken();
        return ((int) st.nval);
    }

    public double nextDouble() throws IOException {
        st.nextToken();
        return (st.nval);
    }

    public String next() throws IOException {
        st.nextToken();
        if (st.ttype == StreamTokenizer.TT_WORD) {
            return (st.sval);
        } else {
            return ("not found");
        }
    }
}


import java.io.InputStream;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;

public class Task {

	private static final boolean readFromFile = false;

	public static void main(String args[]){
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FileOutputStream fileOutputStream;
		FileInputStream fileInputStream;
		if (readFromFile){
			try{
				fileInputStream = new FileInputStream(new File("input.txt"));
				fileOutputStream = new FileOutputStream(new File("output.txt"));
			}catch (FileNotFoundException e){
				throw new RuntimeException(e);
			}
		}
		PrintWriter out = new PrintWriter((readFromFile)?fileOutputStream:outputStream);
		InputReader in = new InputReader((readFromFile)?fileInputStream:inputStream);

		Solver s = new Solver(in,out);
		s.solve();

		out.close();
	}
}

class Solver{
	InputReader in;
	PrintWriter out;

	private char getSim(int sim){
		return (char)(sim+'a');
	}

	public void solve(){
		int n=in.nextInt();
		char a[][] = new char[4][n];
		if (n%2==1){
			int sim=0;
			for (int i=0;i<n-1;i+=2){
				a[0][i]=getSim(sim);
				a[0][i+1]=a[0][i];
				sim = (sim+1)%2;
			}
			a[0][n-1]=getSim(sim);
			a[1][n-1]=a[0][n-1];
			sim = (sim+1)%2;
			for (int i=n-1;i>0;i-=2){
				a[2][i]=getSim(sim);
				a[2][i-1]=a[2][i];
				sim = (sim+1)%2;
			}
			for (int i=n-2;i>=0;i-=2){
				a[1][i]=getSim(sim+2);
				a[1][i-1]=a[1][i];
				sim = (sim+1)%2;
			}
			a[2][0]=getSim(sim+2);
			a[3][0]=a[2][0];
			sim = (sim+1)%2;
			for (int i=1;i<n;i+=2){
				a[3][i]=getSim(sim+2);
				a[3][i+1]=a[3][i];
				sim = (sim+1)%2;
			}
		}
		else{
			int sim=0;
			for (int i=0;i<n;i+=2){
				a[0][i]=getSim(sim);
				a[0][i+1]=a[0][i];
				sim = (sim+1)%2;
			}
			a[1][n-1]=getSim(sim+5);
			a[2][n-1]=a[1][n-1];
			sim = (sim+1)%2;
			for (int i=n-1;i>=0;i-=2){
				a[3][i]=getSim(sim);
				a[3][i-1]=a[3][i];
				sim = (sim+1)%2;
			}
			a[2][0]=getSim(sim+10);
			a[1][0]=a[2][0];
			for (int i=1;i<n-1;i+=2){
				a[1][i]=getSim(sim+2);
				a[1][i+1]=a[1][i];
				sim = (sim+1)%2;
			}
			for (int i=n-2;i>=1;i-=2){
				a[2][i]=getSim(sim+2);
				a[2][i-1]=a[2][i];
				sim = (sim+1)%2;
			}
		}
		for (int i=0;i<4;i++){
			for (int j=0;j<n;j++)
				out.print(a[i][j]);
			out.println();
		}
	}

	Solver(InputReader in, PrintWriter out){
		this.in=in;
		this.out=out;
	}
}

class InputReader{
	private BufferedReader buf;
	private StringTokenizer tok;

	InputReader(InputStream in){
		tok = null;
		buf = new BufferedReader(new InputStreamReader(in));
	}

	InputReader(FileInputStream in){
		tok = null;
		buf = new BufferedReader(new InputStreamReader(in));
	}

	public String next(){
		while (tok==null || !tok.hasMoreTokens()){
			try{
				tok = new StringTokenizer(buf.readLine());
			}catch (IOException e){
				throw new RuntimeException(e);
			}
		}
		return tok.nextToken();
	}

	public int nextInt(){
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

	public double nextDouble(){
		return Double.parseDouble(next());
	}

	public float nextFloat(){
		return Float.parseFloat(next());
	}

	public String nextLine(){
		try{
			return buf.readLine();
		}catch (IOException e){
			return null;
		}
	}
}


#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    if(n&1){
        if(n == 1){
            cout << "a\na\nb\nb";
            return;
        }
        for(int i = 0;i < 2;i++){
            for(int j = 0;j < n/2;j++){
                if(j&1 && i == 1){
                    cout << "cc";
                }
                else if(j&1 && i == 0){
                    cout << "gg";
                }
                else if(i == 1){
                    cout << "dd";
                }
                else{
                    cout << "hh";
                }
            }
            cout << "l\n";
        }
        for(int i = 0;i < 2;i++){
            cout << "m";
            for(int j = 0;j < n/2;j++){
                if(j&1 && i == 1){
                    cout << "cc";
                }
                else if(j&1 && i == 0){
                    cout << "gg";
                }
                else if(i == 1){
                    cout << "dd";
                }
                else{
                    cout << "hh";
                }
            }
            cout << "\n";
        }
    }
    else{
        for(int i = 0;i < n/2;i++){
            if(i&1){
                cout << "aa";
            }
            else{
                cout << "bb";
            }
        }
        cout <<"\n";
        for(int i = 0;i < 2;i++){
            cout << "m";
            for(int j = 0;j < n/2 -1;j++){
                if(j&1 && i == 1){
                    cout << "cc";
                }
                else if(j&1 && i == 0){
                    cout << "gg";
                }
                else if(i == 1){
                    cout << "dd";
                }
                else{
                    cout << "hh";
                }
            }
            cout << "l\n";
        }
        for(int i = 0;i < n/2;i++){
            if(i&1){
                cout << "aa";
            }
            else{
                cout << "bb";
            }
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    if(!n&1){
        cout << -1 <<"\n";
    }
    else{
        for(int i = 0;i < n/2;i++){
            if(i&1){
                cout << "aa";
            }
            else{
                cout << "bb";
            }
        }
        cout <<"\n";
        for(int i = 0;i < 2;i++){
            cout << "m";
            for(int j = 0;j < n/2 -1;j++){
                if(j&1 && i == 1){
                    cout << "cc";
                }
                else if(j&1 && i == 0){
                    cout << "gg";
                }
                else if(i == 1){
                    cout << "dd";
                }
                else{
                    cout << "hh";
                }
            }
            cout << "m\n";
        }
        for(int i = 0;i < n/2;i++){
            if(i&1){
                cout << "aa";
            }
            else{
                cout << "bb";
            }
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    if(n < 3){
        cout << -1 <<"\n";
    }
    else{
        cout << "yyzz\nkcck\nkxxk\n";
        n-=3;
        for(int i = 0;i < n;i++){
            if(i&1){
                cout << "aabb" <<"\n";
            }
            else{
                cout << "ccdd"<<"\n";
            }
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    if(!n&1){
        cout << -1 <<"\n";
    }
    else{
        for(int i = 0;i < n/2;i++){
            if(i&1){
                cout << "aa";
            }
            else{
                cout << "bb";
            }
        }
        cout <<"\n";
        for(int i = 0;i < 2;i++){
            cout << "m";
            for(int i = 0;i < n/2 -1;i++){
                if(i&1){
                    cout << "cc";
                }
                else{
                    cout << "dd";
                }
            }
            cout << "m\n";
        }
        for(int i = 0;i < n/2;i++){
            if(i&1){
                cout << "aa";
            }
            else{
                cout << "bb";
            }
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    if(!n&1){
        cout << -1 <<"\n";
    }
    else{
        for(int i = 0;i < n/2;i++){
            if(i&1){
                cout << "aa";
            }
            else{
                cout << "bb";
            }
        }
        cout <<"\n";
        for(int i = 0;i < 2;i++){
            cout << "m";
            for(int j = 0;j < n/2 -1;j++){
                if(j&1 && i == 1){
                    cout << "cc";
                }
                else if(j&1 && i == 0){
                    cout << "gg";
                }
                else if(i == 1){
                    cout << "dd";
                }
                else{
                    cout << "hh";
                }
            }
            cout << "l\n";
        }
        for(int i = 0;i < n/2;i++){
            if(i&1){
                cout << "aa";
            }
            else{
                cout << "bb";
            }
        }
    }
}


#include<cstdio>
#include<cstring>
#define MAXN 105
using namespace std;
char str[5][MAXN];
int main(){
	int n,m=0;
	memset(str,'\0',sizeof(str));
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		m=m%26;
		for(int j=0;j<=1;j++)str[j][i]=m+'a';
		m++;
	}for(int i=0;i<n;i++){
		m=m%26;
		for(int j=2;j<=3;j++)str[j][i]=m+'a';
		m++;
	}for(int i=0;i<4;i++)printf("%s\n",str[i]);
	return 0;
}


#include<cstdio>
#include<cstring>
#define MAXN 105
using namespace std;
char str[MAXN];
int main(){
	int n,m=0;
	memset(str,'\0',sizeof(str));
	scanf("%d",&n);
	for(int i=0;i+1<n;i+=2){
		m=m%26;str[i+1]=str[i]=m+'a';
		m++;
	}if(n&1)str[n-1]=m+'a',m++;printf("%s\n%s\n",str,str);
	str[0]=m+'a';m++;
	for(int i=1;i+1<n;i+=2){
		m=m%26;str[i+1]=str[i]=m+'a';
		m++;
	}if(n%2==0)str[n-1]=m+'a';
	printf("%s\n%s\n",str,str);
	return 0;
}


#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;

    if (n == 1) cout << "a\na\nb\nb\n";
    else if (n % 2 == 0) {
        for (int i = 1; i <= n / 2; i++) {
            if (i % 2 == 1) cout << "aa";
            else cout << "bb";
        }
        cout << "\nx";
        for (int i = 1; i < n / 2; i++) {
            if (i % 2 == 1) cout << "cc";
            else cout << "dd";
        }
        cout << "y\nx";
        for (int i = 1; i < n / 2; i++) {
            if (i % 2 == 1) cout << "ee";
            else cout << "ff";
        }
        cout << "y\n";
        for (int i = 1; i <= n / 2; i++) {
            if (i % 2 == 1) cout << "gg";
            else cout << "hh";
        }
        cout << "\n";
    } else {
        for (int i = 1; i <= n / 2; i++) {
            if (i % 2 == 1) cout << "aa";
            else cout << "bb";
        }
        cout << "x\n";
        for (int i = 1; i <= n / 2; i++) {
            if (i % 2 == 1) cout << "cc";
            else cout << "dd";
        }
        cout << "x\ny";
        for (int i = 1; i <= n / 2; i++) {
            if (i % 2 == 1) cout << "ee";
            else cout << "ff";
        }
        cout << "\ny";
        for (int i = 1; i <= n / 2; i++) {
            if (i % 2 == 1) cout << "gg";
            else cout << "hh";
        }
        cout << "\n";
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mod 1000000007
#define reset(s,val) memset(s,val,sizeof(s))
#define sqr(x) (x)*(x)

int n;
string s1,s2;

int main( ){
//    freopen("input.txt","r",stdin);
//	ios::sync_with_stdio(0);
	cin>>n;
	if(n==1)
	{
		cout<<"a\na\nb\nb";
		return 0;
	}
	s1=s2="";
	int m=n;
	while(m>1)
	{
		if(s1==""||s1[s1.size()-1]=='b') s1+="aa";
		else s1+="bb";
		m-=2;
	}
	if(m) s1+='e';
	cout<<s1<<endl;
	for(char i:s1)
	{
		if(i=='a') cout<<'c';
		else if(i=='b') cout<<'d';
		else cout<<'e';
	}
	s2='z';
	n-=1;
	cout<<endl;
	while(n>1)
	{
		if(s2[s2.size()-1]=='z'||s2[s2.size()-1]=='x') s2+="yy";
		else s2+="xx";
		n-=2;
	}
	if(n) s2+='k';
	cout<<s2<<endl;
	for(char i:s2)
	{
		if(i=='x') cout<<'y';
		else if(i=='y') cout<<'x';
		else cout<<i;
	}
}


#include <bits/stdc++.h>
#define MOD 1000000007
#define Nmax 1005
#define pb push_back
#define mp make_pair
#define INF 1000000000
#define eps 0.000000000001

using namespace std;

int n;
const int dx[]={-1,-1,0,1,1, 1, 0,-1};
const int dy[]={ 0, 1,1,1,0,-1,-1,-1};
char a[Nmax][Nmax];

inline char Find(int x, int y)
{
    int ok,t;
    for(char sol='a';sol<='z';++sol)
    {
        for(ok=1,t=0;t<8;++t)
            if(sol==a[x-dx[t]][y-dy[t]]) ok=0;
        if(ok) return sol;
    }
}

int main()
{
    int i,j;
    char c;
    #ifndef ONLINE_JUDGE
        freopen ("date.in","r",stdin);
        freopen ("date.out","w",stdout);
    #endif
    cin.sync_with_stdio(0);
    cin>>n;
    if(n==1) cout<<"a\na\nb\nb";
    else
    {
        for(i=0;i<=5;++i)
            for(j=0;j<=n+1;++j) a[i][j]='0';
        a[1][1]=a[2][1]='a';
        for(i=2;i<=n;++i)
            if(i%2==0)
            {
                c=Find(3,i-1); a[3][i-1]=a[3][i]=c;
                c=Find(4,i-1); a[4][i-1]=a[4][i]=c;
            }
            else
            {
                c=Find(1,i-1); a[1][i-1]=a[1][i]=c;
                c=Find(2,i-1); a[2][i-1]=a[2][i]=c;
            }

            if(n%2==0)
            {
                c=Find(2,n); a[1][n]=a[2][n]=c;
            }
            else
            {
                c=Find(3,n); a[3][n]=a[4][n]=c;
            }
        for(i=1;i<=4;++i)
        {
            for(j=1;j<=n;++j) cout<<a[i][j];
            cout<<"\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define MOD 1000000007
#define Nmax 1005
#define pb push_back
#define mp make_pair
#define INF 1000000000
#define eps 0.000000000001

using namespace std;

int n;
const int dx[]={-1,-1,0,1,1, 1, 0,-1};
const int dy[]={ 0, 1,1,1,0,-1,-1,-1};
char a[Nmax][Nmax];

inline char Find(int x, int y)
{
    int ok,t;
    for(char sol='a';sol<='z';++sol)
    {
        for(ok=1,t=0;t<8;++t)
            if(sol==a[x-dx[t]][y-dy[t]]) ok=0;
        if(ok) return sol;
    }
}

int main()
{
    int i,j;
    char c;
    #ifndef ONLINE_JUDGE
        freopen ("date.in","r",stdin);
        freopen ("date.out","w",stdout);
    #endif
    cin.sync_with_stdio(0);
    cin>>n;
    if(n==1) cout<<"a\na\nb\nb";
    else
    {
        for(i=0;i<=5;++i)
            for(j=0;j<=n+1;++j) a[i][j]='0';
        a[1][1]=a[2][1]='a';
        for(i=2;i<=n;++i)
            if(i%2==0)
            {
                c=Find(3,i-1); a[3][i-1]=a[3][i]=c;
                c=Find(4,i-1); a[4][i-1]=a[4][i]=c;
            }
            else
            {
                c=Find(1,i-1); a[1][i-1]=a[1][i]=c;
                c=Find(2,i-1); a[2][i-1]=a[2][i]=c;
            }

            if(n%2==0)
            {
                c=Find(2,i); a[1][n]=a[2][n]=c;
            }
            else
            {
                c=Find(3,i); a[3][n]=a[4][n]=c;
            }
        for(i=1;i<=4;++i)
        {
            for(j=1;j<=n;++j) cout<<a[i][j];
            cout<<"\n";
        }
    }
    return 0;
}


import java.util.ArrayList;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author hrzd7816
 */
public class Contest3ProblemMarks {

    public static int successfull(int students, int subjects, int[][] grades) {

        ArrayList<Integer> studentId = new ArrayList<>();
        int max = 0, higherStudent=0;
        for (int i = 0; i < subjects; i++) {

            for (int j = 0; j < students; j++) {

                if (max <= grades[j][i]) {
                    max = grades[j][i];

                           higherStudent=j;

                }
            }
             if (!studentId.contains(higherStudent)) {
                 studentId.add(higherStudent);
             }
            max = higherStudent = 0;

        }

//        for(int i=0;i<studentId.size();i++)
//            System.out.print(studentId.get(i)+" ");
        return studentId.size();
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {

            String[] studentsMarks = sc.nextLine().split(" ");
            int students = Integer.parseInt(studentsMarks[0]);
            int subjects = Integer.parseInt(studentsMarks[1]);
            int[][] grades = new int[students][subjects];
            //    System.out.println(students+" "+subjects);
            for (int i = 0; i < students; i++) {
                String studentGrade = sc.nextLine();
                for (int j = 0; j < subjects; j++) {
                    grades[i][j] = Integer.parseInt(Character.toString(studentGrade.charAt(j)));

                }

            }

            System.out.println(successfull(students, subjects, grades));
        }
    }
}


import java.util.ArrayList;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author hrzd7816
 */
public class Contest3ProblemMarks {

       public static int successfull(int students, int subjects, int [][] grades){

           ArrayList<Integer> studentId= new ArrayList<>();
          int max =0;
            for (int i = 0; i < subjects; i++) {

                for (int j = 0; j < students; j++) {

                    if(max == grades[j][i])
                        studentId.remove(0);

                    else if(max<grades[j][i]){
                     max=grades[j][i];
                     if(!studentId.contains(i))
                            studentId.add(0,i);
                 }
                }
                max=0;
            }

        return studentId.size();
        }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {

            String[] studentsMarks = sc.nextLine().split(" ");
            int students = Integer.parseInt(studentsMarks[0]);
            int subjects = Integer.parseInt(studentsMarks[1]);
            int[][] grades = new int[students][subjects];
        //    System.out.println(students+" "+subjects);
            for (int i = 0; i < students; i++) {
                String studentGrade = sc.nextLine();
                for (int j = 0; j < subjects; j++) {
                    grades[i][j]=Integer.parseInt(Character.toString(studentGrade.charAt(j)));
                }

            }

            System.out.println(successfull(students, subjects, grades));
        }
    }
}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author hrzd7816
 */
public class Contest3ProblemMarks {

    static int[][] grades;
    static int students, subjects;

    public static int highestMarkPerSubject(int subjectId) {

        int highestMark = 0;
        for (int i = 0; i < students; i++) {
         //   System.out.print(grades[i][subjectId]+" ");

            if (highestMark <= grades[i][subjectId]) {
                highestMark = grades[i][subjectId];
            }
        }
      //   System.out.println("---------");
        return highestMark;
    }

    public static int successfull() {

        HashSet<Integer> studentId = new HashSet<>();
        int higherMark = -1;

        for (int i = 0; i < subjects; i++) {

            higherMark = highestMarkPerSubject(i);
            for (int j = 0; j < students; j++) {
               // System.out.println("sub= "+i +" student= "+j);
                if (grades[j][i] == higherMark) {
                    studentId.add(j);
                }

            }

        }

        return studentId.size();
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {

            String[] studentsMarks = sc.nextLine().split(" ");
            students = Integer.parseInt(studentsMarks[0]);
            subjects = Integer.parseInt(studentsMarks[1]);
            grades = new int[students][subjects];
            //    System.out.println(students+" "+subjects);
            for (int i = 0; i < students; i++) {
                String studentGrade = sc.nextLine();
                for (int j = 0; j < subjects; j++) {
                    grades[i][j] = Integer.parseInt(Character.toString(studentGrade.charAt(j)));

                }

            }

            System.out.println(successfull());
        }
    }
}


import java.util.ArrayList;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author hrzd7816
 */
public class Contest3ProblemMarks {

    public static int successfull(int students, int subjects, int[][] grades) {

        ArrayList<Integer> studentId = new ArrayList<>();
        int max = 0, higherStudent=-1, higherMark=-1;
        for (int i = 0; i < subjects; i++) {

            for (int j = 0; j < students; j++) {

                if (max <= grades[j][i]) {
                    max = grades[j][i];

                     higherMark=max;
                     if(higherMark==max){
                         if(!studentId.contains(j))
                        studentId.add(j);
                     }
                    higherStudent=j;
                }
            }
           if (!studentId.contains(higherStudent))
                 studentId.add(higherStudent);

            max = higherStudent = higherMark = -1;

        }

//        for(int i=0;i<studentId.size();i++)
//            System.out.print(studentId.get(i)+" ");
        return studentId.size();
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {

            String[] studentsMarks = sc.nextLine().split(" ");
            int students = Integer.parseInt(studentsMarks[0]);
            int subjects = Integer.parseInt(studentsMarks[1]);
            int[][] grades = new int[students][subjects];
            //    System.out.println(students+" "+subjects);
            for (int i = 0; i < students; i++) {
                String studentGrade = sc.nextLine();
                for (int j = 0; j < subjects; j++) {
                    grades[i][j] = Integer.parseInt(Character.toString(studentGrade.charAt(j)));

                }

            }

            System.out.println(successfull(students, subjects, grades));
        }
    }
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.*;

//import java.text.DecimalFormat;
/**
 *
 * @author emaK
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
      Scanner next;
        next = new Scanner(System.in);

                char c;
        String s = null;
        int x,y;
        x=next.nextInt();
        y=next.nextInt();
        ArrayList <String> l=new  ArrayList<String>();
        for(int i=0;i<x;i++)
        {

        s=next.next();

        l.add(s);
        s=null;
        }
        int q=0;
        char r='0';
        String in=null;
        ArrayList<Integer> a=new ArrayList<Integer>();
        //String val=null;
        for(int i=0;i<y;i++)
        {
        //System.out.println("kkkkkkkkkkkkkkkkk");
        for(int j=0;j<x;j++)
        {
        //System.out.println("kkkkkkkkkkkkkkkkk");

        char p;
        p=(char)j;
        if(l.get(j).charAt(i)>r)
        {
        r=l.get(j).charAt(i);
        //val=null;
        }

        /*else if(l.get(j).charAt(i)==r&&in.indexOf(p)!=-1)
        {
        char h;
        h=(char) j;
        in+=h;
        // System.out.println("kkkkkkkkkkkkkkkkk");
        h=(char)l.get(j).charAt(i);
        val+=h;
        }*/
}
        for(int k=0;k<x;k++)
        {
            if(r==l.get(k).charAt(i)&&!a.contains(k))
            {

                a.add(k);
            }
        }
         r='0';
}
System.out.println(a.size());

        /*int x;
        x=next.nextInt();
        ArrayList <Integer> l =new ArrayList<Integer>();
        ArrayList <Integer> m =new ArrayList<Integer>();
        for(int i=0;i<x;i++)
        {
        int y;
        y=next.nextInt();
        l.add(y);
        m.add(y);
        }

        int o=0,k=0;
        for(int i=0;i<l.size();i++)
        {
        if(m.get(0)!=25)
        {
        System.out.println("NO");
        k=1;
        break;
        }
        if(i==0)
        continue;
        if(l.get(i)==25)
        continue;
        if(l.get(i)==50)
        {
        for(int j=0;j<i;j++)
        {
        if(l.get(j)==25)
        {

        l.remove(j);
        j--;
        i--;
        o=1;

        break;
        }
        }
        if(o==0)
        {
        System.out.println("NO");
        k=1;
        break;
        }
        o=0;
        }
        if(l.get(i)==100)
        {

        int e=0;
        for(int j=0;j<i;j++)
        {
        if(l.get(j)==50)
        {

        if(e<50)
        {

        l.remove(j);
        j--;
        i--;
        e+=50;
        break;
        }

        }
        }
        for(int j=0;j<i;j++)
        {
        if(l.get(j)==25)
        {

        if(e<75)
        {

        l.remove(j);
        j--;
        i--;
        e+=25;
        break;
        }
        }
        }
        if(e!=75)
        {
        System.out.println("NO");
        k=1;
        break;
        }

        }

        }
        if(k==0)
        {
        System.out.println("YES");
        }*/

            /*for(int i=x;i>0;)
            {
            double a;

            //DecimalFormat dff = new DecimalFormat("#.");

            a=(double)i/10;

            i/=10;
            //int c=(int)a;
            double c= ((a-i)*10);
            int b;
            // b = 10*(int) (df.format(c));
            String r;
            //r=dff.format(c);
            //b=(int)r;
            System.out.println(c);

            if(b!=4||b!=7)
            {
            u=0;
            }
            }
            if(u==1)
            {
            System.out.println("Yes");
            }
            else
            System.out.println("No");
            }*/
    }
        }

        /*  for(float i=0;i<=2.1;i+=.2)
        {
        for(float j=1+i;j<=3+i;j++)
        {
        Scanner next;
        next = new Scanner(System.in);
        DecimalFormat df = new DecimalFormat("#.0");
        float x=j+i;
        System.out.println("I="+df.format(i)+" "+"J="+df.format(j));

        }
        }

        */

        // TODO code application logic here


import java.io.*;
import java.util.*;

public class p152a
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int arr[][] = new int[n][m];
        for(int i=0;i<n;i++)
        {
            int a = sc.nextInt();
            for(int j=0;j<m;j++)
            {
                arr[i][m-j-1] = a%10;
                a /= 10;
            }
        }
        int c = 0;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                int b = 0;
                for(int k=0;k<n;k++)
                {
                    if(arr[i][j]>=arr[k][j]) b++;
                }
                if(b==n)
                {
                    c++;
                    break;
                }
            }
        }
        System.out.println(c);
    }
}


import java.io.*;
import java.util.*;
import java.math.*;

public class p152a
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        BigInteger a10 = new BigInteger("10");
        int n = sc.nextInt();
        int m = sc.nextInt();
        int arr[][] = new int[n][m];
        for(int i=0;i<n;i++)
        {
            BigInteger a = sc.nextBigInteger();
            for(int j=0;j<m;j++)
            {
                arr[i][m-j-1] = (a.mod(a10)).intValue();
                a = a.divide(a10);
            }
        }
        int c = 0;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                int b = 0;
                for(int k=0;k<n;k++)
                {
                    if(arr[i][j]>=arr[k][j]) b++;
                }
                if(b==n)
                {
                    c++;
                    break;
                }
            }
        }
        System.out.println(c);
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

public class Main {
  public final static long MOD = 1000000007;
  public static void main(String[] args) {
    MyScanner sc = new MyScanner();
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[][] a = new int[n][m];
    boolean[] s = new boolean[n];
    for (int i = 0; i < n; ++i) {
      String line = sc.nextLine();
      for (int j = 0; j < m; ++j) {
        a[i][j] = line.charAt(j);
      }
    }
    int ns = 0;
    for (int j = 0; j < m; ++j) {
      int max = 0;
      boolean shared = false;
      for (int i = 0; i < n; ++i) {
        if (a[i][j] > max) {
          max = a[i][j];
        }
      }
      for (int i = 0; i < n; ++i) {
        if (a[i][j] == max) {
          s[i] = true;
        }
      }
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      if (s[i]) ans++;
    }
    System.out.println(ans);
  }

  public static class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        }
        catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    String nextLine() {
      String str = "";
      try { str = br.readLine(); }
      catch (IOException e) { e.printStackTrace(); }
      return str;
    }
  }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

public class Main {
  public final static long MOD = 1000000007;
  public static void main(String[] args) {
    MyScanner sc = new MyScanner();
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[][] a = new int[n][m];
    for (int i = 0; i < n; ++i) {
      String line = sc.nextLine();
      for (int j = 0; j < m; ++j) {
        a[i][j] = line.charAt(j);
      }
    }
    int ns = 0;
    for (int j = 0; j < m; ++j) {
      int max = 0;
      boolean shared = false;
      for (int i = 0; i < n; ++i) {
        if (a[i][j] > max) {
          max = a[i][j];
          shared = false;
        } else if (a[i][j] == max) {
          shared = true;
        }
      }
      if (shared) ns++;
    }
    System.out.println(ns);
  }

  public static class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        }
        catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    String nextLine() {
      String str = "";
      try { str = br.readLine(); }
      catch (IOException e) { e.printStackTrace(); }
      return str;
    }
  }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

public class Main {
  public final static long MOD = 1000000007;
  public static void main(String[] args) {
    MyScanner sc = new MyScanner();
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[][] a = new int[n][m];
    for (int i = 0; i < n; ++i) {
      String line = sc.nextLine();
      for (int j = 0; j < m; ++j) {
        a[i][j] = line.charAt(j);
      }
    }
    int ns = 0;
    for (int j = 0; j < m; ++j) {
      int max = 0;
      boolean shared = false;
      for (int i = 0; i < n; ++i) {
        if (a[i][j] > max) {
          max = a[i][j];
          shared = false;
        } else if (a[i][j] == max) {
          shared = true;
        }
      }
      if (!shared) ns++;
    }
    System.out.println(ns);
  }

  public static class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        }
        catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    String nextLine() {
      String str = "";
      try { str = br.readLine(); }
      catch (IOException e) { e.printStackTrace(); }
      return str;
    }
  }
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Marks {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		char[][] marks = new char[m][n];
		Set<Integer> studentsIds = new HashSet<>();
		for (int i = 0; i < n; i++) {
			String line = scanner.next();
			for (int j = 0; j < m; j++) {
				marks[j][i] = line.charAt(j);
			}
		}
		for (int i = 0; i < m; i++) {
			char max = 0;
			for (int j = 0; j < n; j++) {
				if (max <= marks[i][j]) {
					max = marks[i][j];
				}
			}
			String line = new String(marks[i]);
			for (int k = 0; k < line.length(); k++) {
				if (line.charAt(k) == max)
					studentsIds.add(k);
			}
		}
		System.out.println(studentsIds.size());
	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Marks {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		char[][] marks = new char[m][n];
		Set<Integer> studentsIds = new HashSet<>();
		for (int i = 0; i < n; i++) {
			String line = scanner.next();
			for (int j = 0; j < m; j++) {
				marks[j][i] = line.charAt(j);
			}
		}
		for (int i = 0; i < m; i++) {
			boolean isEqual = false;
			int max = 0;
			int maxStudentIndex = -1;
			for (int j = 0; j < n; j++) {
				if (max != 0) {
					isEqual = max == marks[i][j];
				}
				if (max <= marks[i][j]) {
					max = marks[i][j];
					maxStudentIndex = j;
				}
			}
			if (isEqual) {
				for (int k = 0; k < n; k++) {
					studentsIds.add(k);
				}
			} else
				studentsIds.add(maxStudentIndex);
		}
		System.out.println(studentsIds.size());
	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Marks {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		char[][] marks = new char[m][n];
		Set<Integer> studentsIds = new HashSet<>();
		for (int i = 0; i < n; i++) {
			String line = scanner.next();
			for (int j = 0; j < m; j++) {
				marks[j][i] = line.charAt(j);
			}
		}
		for (int i = 0; i < m; i++) {
			int max = 0;
			int maxStudentIndex = -1;
			for (int j = 0; j < n; j++) {
				if (max <= marks[i][j]) {
					max = marks[i][j];
					maxStudentIndex = j;
				}
			}
			String line = new String(marks[i]);
			line = line.replace(line.charAt(0)+"", "");
			if (line.isEmpty()) {
				for (int k = 0; k < n; k++) {
					studentsIds.add(k);
				}
			} else
				studentsIds.add(maxStudentIndex);
		}
		System.out.println(studentsIds.size());
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class NewMain1 {

    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        InputStreamReader istream = new InputStreamReader(System.in);
        BufferedReader bf = new BufferedReader(istream);

        int n = scan.nextInt();
        int m = scan.nextInt();
        int arr[][] = new int[n][m];
        int count = 0;
        int max[];
        max = new int[m];
        int mslha[] = new int[n];
        for (int i = 0; i < n; i++) {
            int num=scan.nextInt();
            for (int j = 0; j < m; j++) {
                arr[i][j] = num%10;
                num/=10;
                if (arr[i][j] > max[j]) {
                    max[j] = arr[i][j];
                }

            }
        }

        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (arr[j][i] >= max[i]) {
                    mslha[j] = 1;
                }
            }
        }

        for (int i = 0; i < n; i++) {
            if (mslha[i] == 1) {
                count++;
            }

        }
        System.out.println(count);
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class NewMain1 {

    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        InputStreamReader istream = new InputStreamReader(System.in);
        BufferedReader bf = new BufferedReader(istream);

        int n = scan.nextInt();
        int m = scan.nextInt();
        int arr[][] = new int[n][m];
        int count = 0;
        int max[];
        max = new int[m];
        int mslha[] = new int[m];
        for (int i = 0; i < n; i++) {
            int num=scan.nextInt();
            for (int j = 0; j < m; j++) {
                arr[i][j] = num%10;
                num/=10;
                if (arr[i][j] > max[j]) {
                    max[j] = arr[i][j];
                }

            }
        }

        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (arr[j][i] >= max[i]) {
                    mslha[j] = 1;
                }
            }
        }

        for (int i = 0; i < n; i++) {
            if (mslha[i] == 1) {
                count++;
            }

        }
        System.out.println(count);
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class NewMain1 {

    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        InputStreamReader istream = new InputStreamReader(System.in);
        BufferedReader bf = new BufferedReader(istream);

        int n = scan.nextInt();
        int m = scan.nextInt();
        int arr[][] = new int[n][m];
        int count = 0;
        int max[];
        max = new int[m];
        int mslha[] = new int[n];
        for (int i = 0; i < n; i++) {
            String num=scan.next();
            for (int j = 0; j < m; j++) {
                arr[i][j] =num.charAt(j);

                if (arr[i][j] > max[j]) {
                    max[j] = arr[i][j];
                }

            }
        }

        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (arr[j][i] >= max[i]) {
                    mslha[j] = 1;
                }
            }
        }

        for (int i = 0; i < n; i++) {
            if (mslha[i] == 1) {
                count++;
            }

        }
        System.out.println(count);
    }

}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class A {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[][] a = new int[n][m];
		for (int i = 0; i < n; i++) {
			String s = sc.next();
			for (int j = 0; j < s.length(); j++) {
				a[i][j] = s.codePointAt(j) - 48;
			}
		}
		int ans = 0;
		for (int i = 0; i < n; i++) {
			boolean count = false;
			for (int j = 0; j < m; j++) {
				boolean used = true;
				for (int k = 0; k < n; k++) {
					if (a[k][j] > a[i][j]) used = false;
				}
				if (used) count = true;
			}
			ans += count?1:0;
		}
		System.out.println(ans);
	}

}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class A {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int cnt = 0;
		int [][]a = new int [n][m];
		for (int i = 0; i <n; i++) {
			String s = sc.next();
			for (int j = 0; j < s.length(); j++) {
				a[i][j] = s.codePointAt(j)-48;
			}
		}
		Set<Integer> s = new HashSet<Integer>();
		for (int i = 0; i < m; i++) {
			int max = a[0][i];
			int id = 0;
			for (int j = 0; j < n; j++) {
				if (max < a[j][i] ){
					max = a[j][i];
					id = j;
				}else if (max == a[j][i] && !s.contains(j)) id = j;
			}
			if (!s.contains(id)){
				s.add(id);
			}
		}
		System.out.println(s.size());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class ProblemA {
	public static void main(String[] args) {
		InputReader in = new InputReader();
		PrintWriter out = new PrintWriter(System.out);

		new ProblemA().solve(in, out);

		out.close();
	}

	public void solve(InputReader in, PrintWriter out) {
		int n = in.nextInt();
		int m = in.nextInt();

		int[][] a = new int[n][m];
		for (int i = 0; i < n; i++) {

			String s = in.next();

			for (int j = 0; j < m; j++) {
				a[i][j] = s.charAt(j) - '0';
			}
		}

		Set<Integer> set = new HashSet<Integer>();

		for (int j = 0; j < m; j++) {
			int max = 0;

			for (int i = 0; i < n; i++) {
				max = Math.max(max, a[i][j]);
			}

			for (int i = 0; i < n; i++) {
				if (a[i][j] == max) {
					set.add(i);
				}
			}

		}

		out.println(set.size());
	}

	static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;

		public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();

		for(int i = 0; i<m; i++)
		{
			int max = 0;
			int index = 0;
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' >= max && !hs.contains(j)) {
					max = arr[j].charAt(i) - '0';
					index = j;

				}
			if(!hs.contains(index))
				hs.add(index);
		}
		System.out.println(hs.size());

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();

		for(int i = 0; i<m; i++)
		{
			int max = 0;
			int index = -1;
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' >= max) {
					max = arr[j].charAt(i) - '0';
				}
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' >= max) {
					if(!hs.contains(index))
						index = j;
				}
			if(!hs.contains(index) && index >= 0)
				hs.add(index);
		}
		System.out.println(hs.size());

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();

		for(int i = 0; i<m; i++)
		{
			int max = 0;
			int index = -1;
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' >= max) {
					max = arr[j].charAt(i) - '0';
				}
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' >= max) {
					if(!hs.contains(index))
						index = j;
					break;
				}
			if(!hs.contains(index) && index >= 0)
				hs.add(index);
		}
		System.out.println(hs.size());

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();
		int count = 0;
		for(int i = 0; i<n; i++)
		{
			int max = 0;
			int index = 0;
			for(int j = 0; j<m; j++)
				if(arr[i].charAt(j) - '0' > max && !hs.contains(j) ) {
					max = arr[i].charAt(j) - '0';
					index = j;
				}
			if(!hs.contains(index)) {
				hs.add(index);
				count++;
			}
		}
		System.out.println(hs.size());

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();
		Set<Integer> temp = new HashSet();
		for(int i = 0; i<m; i++)
		{
			int max = 0;
			int index = 0;
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' >= max) {
					max = arr[j].charAt(i) - '0';
					temp.add(j);

				}
			temp.removeAll(hs);
			hs.addAll(temp);
		}
		System.out.println(hs.size());

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();
		int count = 0;
		for(int i = 0; i<n; i++)
		{
			int temp = arr[i].charAt(0) - '0';
			for(int j = 1; j<m; j++)
				if(arr[i].charAt(j) - '0' > temp ) {
					temp = arr[i].charAt(j) - '0';
				}
			if(!hs.contains(temp)) {
				hs.add(temp);
				count++;
			}
		}
		System.out.println(count);

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();
		int count = 0;
		for(int i = 0; i<n; i++)
		{
			int max = 0;
			int index = 0;
			for(int j = 0; j<m; j++)
				if(arr[i].charAt(j) - '0' >= max && !hs.contains(j) ) {
					max = arr[i].charAt(j) - '0';
					index = j;
				}
			if(!hs.contains(index)) {
				hs.add(index);
				count++;
			}
		}
		System.out.println(hs.size());

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();

		for(int i = 0; i<m; i++)
		{
			int max = 0;
			int index = -1;
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' >= max) {
					max = arr[j].charAt(i) - '0';
					if(!hs.contains(j))
						index = j;

				}
			if(!hs.contains(index) && index >0)
				hs.add(index);
		}
		System.out.println(hs.size());

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();
		for(int i = 0; i<m; i++)
		{
			int max = 0;
			int index = 0;
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' >= max) {
					max = arr[j].charAt(i) - '0';
					index = j;

				}

			if(!hs.contains(index)) {
				hs.add(index);
			}
		}
		System.out.println(hs.size());

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();

		for(int i = 0; i<m; i++)
		{
			int max = 0;
			int index = -1;
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' > max)
					max = arr[j].charAt(i) - '0';

			for(int j = 0; j<n; j++) {
				if(arr[j].charAt(i) - '0' == max) {
					if(!hs.contains(j)) {
						hs.add(j);

					}
				}
			}

		}
		System.out.println(hs.size());

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();

		for(int i = 0; i<m; i++)
		{
			int max = 0;
			int index = 0;
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' >= max) {
					max = arr[j].charAt(i) - '0';
					index = j;

				}
			if(!hs.contains(index))
				hs.add(index);
		}
		System.out.println(hs.size());

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();

		for(int i = 0; i<m; i++)
		{
			int max = 0;
			int index = -1;
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' >= max) {
					max = arr[j].charAt(i) - '0';
					if(!hs.contains(j))
						index = j;

				}
			if(!hs.contains(index) && index >= 0)
				hs.add(index);
		}
		System.out.println(hs.size());

	}
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> hs = new HashSet();
		String [] arr = new String[n];
		for(int i = 0; i<n; i++)
			arr[i] = sc.next();

		for(int i = 0; i<m; i++)
		{
			int max = 0;
			int index = 0;
			for(int j = 0; j<n; j++)
				if(arr[j].charAt(i) - '0' >= max) {
					max = arr[j].charAt(i) - '0';
					if(!hs.contains(j))
						index = j;

				}
			if(!hs.contains(index))
				hs.add(index);
		}
		System.out.println(hs.size());

	}
}


import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Ahmed Nashaat OLC
 */
public class MAin{
        public static void main(String st[]) {
        Scanner console = new Scanner(System.in);
            int n = console.nextInt();
            int m = console.nextInt();
            int x[][]=new int[n][m];
            int max[]=new int[m];
            for(int i=0;i<n;i++){
                char carr[]=console.next().toCharArray();
                for (int j = 0; j < carr.length; j++) {
                   x[i][j]=Integer.parseInt(""+carr[j]);
                   if(i==0){
                     max[j]= x[i][j];
                   }else{
                      if(x[i][j]>max[j]) max[j]=x[i][j];
                   }
                }
            }
            int result=0;
            for(int i=0;i<n;i++){
                for (int j = 0; j < x[0].length; j++) {
                   if(x[i][j]== max[j]){
                     max[j]= x[i][j];
                     result++;
                     break;
                   }else{
                      if(x[i][j]>max[j]) max[j]=x[i][j];
                   }
                }
            }
            System.out.println(result);

    }
}


import java.util.Scanner;
public class Marks {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n,m;
        n=input.nextInt();
        m=input.nextInt();
        String [] grades = new String[n];
        for(int i=0; i<n; i++){
            grades[i]=input.next();
        }
        char max;
        int maxindex;
        boolean [][] check=new boolean[n][m];
        for(int j=0; j<m; j++){
            max=grades[0].charAt(j);
            for(int i=1; i<n; i++){
                if(max<grades[i].charAt(j)){
                    max=grades[i].charAt(j);
                }
            }
            for(int i=0; i<n; i++){
                if(grades[i].charAt(j)==max){
                check[i][j]=true;
                }
            }
        }
        int counter=0;
        boolean found=false;
        for(int i=0; i<check.length; i++){
            for(int j=0; j<m && !found; j++){
                if(check[i][j]){
                counter++;
                found=true;
                }
            }
            found=false;
        }
        System.out.println(counter);
    }
}


import java.util.*;
import java.io.*;
public class Marks
{
    static final int INF = Integer.MAX_VALUE;
    static final int NINF = Integer.MIN_VALUE;
    public static void exit()
    {
        System.exit(0);
    }
    public static void main(String[]args) throws IOException
    {
        //Scanner sc = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        String [] grades = new String[n];
        boolean [] success = new boolean[n];

        for(int i = 0; i < n; i++)
            grades[i] = br.readLine();

        for(int i = 0; i < m; i++)
        {
            int max = 0;
            for(int j = 0; j < n; j++)
                max = Math.max(grades[j].charAt(i)-'0', max);

            for(int j = 0; j < n; j++)
            {
                if(grades[j].charAt(i)-'0' == max)
                    success[j] = true;
            }
        }

        int res = 0;
        for(int i = 0; i < n; i++)
            if(success[i])
                res++;
        System.out.println(res);

    }
}


import java.util.*;
import java.io.*;
public class Marks
{
    static final int INF = Integer.MAX_VALUE;
    static final int NINF = Integer.MIN_VALUE;
    public static void exit()
    {
        System.exit(0);
    }
    public static void main(String[]args) throws IOException
    {
        //Scanner sc = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        char [][] grades = new char[n][m];
        boolean [] success = new boolean[n];

        for(int i = 0; i < n; i++)
            grades[i] = br.readLine().toCharArray();

        for(int i = 0; i < m; i++)
        {
            int max = 0;
            for(int j = 0; j < n; j++)
                max = Math.max(grades[j][i]-'0', max);

            for(int j = 0; j < n; j++)
            {
                if(grades[j][i]-'0' == max)
                    success[j] = true;
            }
        }

        int res = 0;
        for(int i = 0; i < n; i++)
            if(success[i])
                res++;
        System.out.println(res);

    }
}


import java.util.*;
public class Marks
{
    static final int INF = Integer.MAX_VALUE;
    static final int NINF = Integer.MIN_VALUE;
    public static void exit()
    {
        System.exit(0);
    }
    public static void main(String[]args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        String [] arr = new String[n];
        for(int i = 0; i < n; i++)
            arr[i] = sc.next();

        int res = 0;
        for(int i = 0; i < n; i++)
        {
            for(int k = 0; k < m; k++)
            {
                boolean success = true;
                for(int j = 0; j < n; j++)
                {
                    if(i == j)
                        continue;
                    if(arr[i].charAt(k)-'1' < arr[j].charAt(k)-'1')
                    {
                        success = false;
                        break;
                    }
                }
                if(success)
                {
                    res++;
                    break;
                }
            }
        }
        System.out.println(res);
    }
}


import java.util.*;
public class Marks
{
    static final int INF = Integer.MAX_VALUE;
    static final int NINF = Integer.MIN_VALUE;
    public static void exit()
    {
        System.exit(0);
    }
    public static void main(String[]args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        String [] grades = new String[n];
        boolean [] success = new boolean[n];

        for(int i = 0; i < n; i++)
            grades[i] = sc.next();

        for(int i = 0; i < m; i++)
        {
            int max = 0;
            for(int j = 0; j < n; j++)
                max = Math.max(grades[j].charAt(i)-'0', max);

            for(int j = 0; j < n; j++)
            {
                if(grades[j].charAt(i)-'0' == max)
                    success[j] = true;
            }
        }

        int res = 0;
        for(int i = 0; i < n; i++)
            if(success[i])
                res++;
        System.out.println(res);

    }
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static class Student {
		public int studentNumber;
		ArrayList<Integer> marks = new ArrayList<Integer>();

		public Student(int num, ArrayList<Integer> allMarks) {
			studentNumber = num;
			marks = allMarks;

		}
	}

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int students = scanner.nextInt();
		int subjects = scanner.nextInt();
		ArrayList<Student> studentsArray = new ArrayList<Main.Student>();
		int[] maxGrade = new int[subjects];
		for (int i = 0; i < students; i++) {
			double studentGrades = scanner.nextDouble();
			ArrayList<Integer> marks = new ArrayList<Integer>();
			for (int j = 0; j < subjects; j++) {
				int studentGrade = (int) studentGrades % 10;
				marks.add(studentGrade);
				studentGrades /= 10;
				if (maxGrade[j] < studentGrade) {
					maxGrade[j] = studentGrade;
				}
			}

			studentsArray.add(new Student(i, marks));
		}

		Set<Integer> distinctStudents = new HashSet<Integer>();

		for (int i = 0; i < students; i++) {
			for (int subject = 0; subject < subjects; subject++) {
				if(studentsArray.get(i).marks.get(subject) == maxGrade[subject])
					distinctStudents.add(i);
			}
		}
		//
		System.out.println(distinctStudents.size());

	}
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int students = scanner.nextInt();
        int subjects = scanner.nextInt();
        HashMap<Integer, Integer> subjectGrade = new HashMap<Integer, Integer>();
        HashMap<Integer, Integer> subjectStudent = new HashMap<Integer, Integer>();

        for (int i = 0; i < students; i++) {
            int studentGrades = scanner.nextInt();
            for (int j = 0; j < subjects; j++) {
                int studentGrade = studentGrades % 10;
                studentGrades /= 10;
                if (!subjectGrade.containsKey(j)) {
                    subjectGrade.put(j, studentGrade);
                    subjectStudent.put(j, i);
                } else {
                    if (studentGrade >= subjectGrade.get(j)) {
                        subjectGrade.put(j, studentGrade);
                        subjectStudent.put(j, i);
                    }
                }
            }
        }

        System.out
                .println(new HashSet<Integer>(subjectStudent.values()).size());

    }
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static class Student {
		public int studentNumber;
		ArrayList<Integer> marks = new ArrayList<Integer>();

		public Student(int num, ArrayList<Integer> allMarks) {
			studentNumber = num;
			marks = allMarks;

		}
	}

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int students = scanner.nextInt();
		int subjects = scanner.nextInt();
		ArrayList<Student> studentsArray = new ArrayList<Main.Student>();
		int[] maxGrade = new int[subjects];
		for (int i = 0; i < students; i++) {
			int studentGrades = scanner.nextInt();
			ArrayList<Integer> marks = new ArrayList<Integer>();
			for (int j = 0; j < subjects; j++) {
				int studentGrade = studentGrades % 10;
				marks.add(studentGrade);
				studentGrades /= 10;
				if (maxGrade[j] < studentGrade) {
					maxGrade[j] = studentGrade;
				}
			}

			studentsArray.add(new Student(i, marks));
		}

		Set<Integer> distinctStudents = new HashSet<Integer>();

		for (int i = 0; i < students; i++) {
			for (int subject = 0; subject < subjects; subject++) {
				if(studentsArray.get(i).marks.get(subject) == maxGrade[subject])
					distinctStudents.add(i);
			}
		}
		//
		System.out.println(distinctStudents.size());

	}
}


import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static class Student {
        public int studentNumber;
        ArrayList<Integer> marks = new ArrayList<Integer>();

        public Student(int num, ArrayList<Integer> allMarks) {
            studentNumber = num;
            marks = allMarks;

        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int students = scanner.nextInt();
        int subjects = scanner.nextInt();
        scanner.nextLine();
        ArrayList<Student> studentsArray = new ArrayList<Main.Student>();
        int[] maxGrade = new int[subjects];
        for (int i = 0; i < students; i++) {
            BigInteger studentGrades = new BigInteger(scanner.nextLine());
            ArrayList<Integer> marks = new ArrayList<Integer>();
            for (int j = 0; j < subjects; j++) {
                int studentGrade = studentGrades.mod(BigInteger.valueOf(10L)).intValue();
                marks.add(studentGrade);
                studentGrades = studentGrades.divide(BigInteger.valueOf(10L));
                if (maxGrade[j] < studentGrade) {
                    maxGrade[j] = studentGrade;
                }
            }

            studentsArray.add(new Student(i, marks));
        }

        Set<Integer> distinctStudents = new HashSet<Integer>();

        for (int i = 0; i < students; i++) {
            for (int subject = 0; subject < subjects; subject++) {
                if(studentsArray.get(i).marks.get(subject) == maxGrade[subject])
                    distinctStudents.add(i);
            }
        }
        //
        System.out.println(distinctStudents.size());

    }
}


import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.InputStream;
import java.lang.*;

public class a {
	private static final int MAX = 105;

    public static void main(String []args){
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader cin = new InputReader(inputStream);
		PrintWriter cout = new PrintWriter(outputStream);

		int n=cin.nextInt(),m=cin.nextInt(),t;
		int[]tourist=new int[MAX];
		int[][]petr=new int[MAX][MAX];
		boolean []kadal=new boolean[MAX];

		Arrays.fill(tourist,0);
		Arrays.fill(kadal,false);

		for(int i=0;i<n;i++) {
			String s=cin.next();

			for(int j=0;j<m;j++) {
				t=Character.getNumericValue(s.charAt(j));
				petr[i][j]=t;
				//cout.print(t+" ");
				tourist[j]=Math.max(tourist[j],t);
			}
			//cout.println("");
		}

		for(int i=0;i<n;i++)
			for(int j=0;j<m;j++)
			if (petr[i][j]==tourist[j]) kadal[i]=true;

		int res=0;
		for(int i=0;i<n;i++) if (kadal[i]) res++;

		cout.println(res);
		cout.close();
    }
}

/* Java Template */
class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }
}


import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.InputStream;
import java.lang.*;

public class a {
	private static final int MAX = 105;

    public static void main(String []args){
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader cin = new InputReader(inputStream);
		PrintWriter cout = new PrintWriter(outputStream);

		int n=cin.nextInt(),m=cin.nextInt(),t;
		int[]tourist=new int[MAX];
		int[][]petr=new int[MAX][MAX];
		boolean []kadal=new boolean[10];

		Arrays.fill(tourist,0);
		Arrays.fill(kadal,false);

		for(int i=0;i<n;i++) {
			String s=cin.next();

			for(int j=0;j<m;j++) {
				t=Character.getNumericValue(s.charAt(j));
				petr[i][j]=t;
				//cout.print(t+" ");
				tourist[j]=Math.max(tourist[j],t);
			}
			//cout.println("");
		}

		for(int i=0;i<n;i++)
			for(int j=0;j<m;j++)
			if (petr[i][j]==tourist[j]) kadal[i]=true;

		int res=0;
		for(int i=0;i<n;i++) if (kadal[i]) res++;

		cout.println(res);
		cout.close();
    }
}

/* Java Template */
class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }
}