import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.stream.IntStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.stream.Stream;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakharjain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        _955D solver = new _955D();
        solver.solve(1, in, out);
        out.close();
    }

    static class _955D {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            int k = in.nextInt();

            String s = in.next();
            String t = in.next();

            Kmp<Character> kmp1 = new Kmp<Character>(
                    s.chars().mapToObj(c -> (char) c).toArray(Character[]::new), t.chars().mapToObj(c -> (char) c).toArray(Character[]::new));

            kmp1.fail();
            kmp1.matches(k);
            kmp1.can();

            String sr = new StringBuilder(s).reverse().toString();
            String tr = new StringBuilder(t).reverse().toString();

            Kmp<Character> kmp2 = new Kmp<Character>(
                    sr.chars().mapToObj(c -> (char) c).toArray(Character[]::new), tr.chars().mapToObj(c -> (char) c).toArray(Character[]::new));

            kmp2.fail();
            kmp2.matches(k);
            kmp2.can();

            for (int i = 0; i <= m; i++) {
                int lai = kmp1.ans[i];

                int rai = kmp2.ans[m - i];

                int raia = n - 1 - rai;

                if (lai < raia && lai - k + 1 >= 0 && raia + k - 1 < n) {

                    out.println("Yes");
                    out.print(lai + 1 - k + 1);
                    out.print(" ");
                    out.print(raia + 1);

                    return;
                }
            }

            out.println("No");
        }

        class Kmp<T extends Comparable<T>> {
            T[] s;
            T[] p;
            int n;
            int m;
            int[] f;
            int[] ans;
            int[] ansi;

            public Kmp(T[] s, T[] p) {
                super();
                this.s = s;
                this.p = p;
                this.n = s.length;
                this.m = p.length;
                this.f = new int[m];
                this.ans = new int[n + 1];
                for (int i = 1; i <= n; i++)
                    this.ans[i] = n;
                this.ansi = new int[n];
            }

            void fail() {
                f[0] = -1;

                for (int i = 1; i < m; i++) {
                    int c = f[i - 1];

                    f[i] = -1;
                    while (c > -1) {
                        if (p[c + 1].equals(p[i])) {
                            f[i] = c + 1;
                            break;
                        } else {
                            c = f[c];
                        }
                    }

                    if (f[i] == -1) {
                        if (p[0].equals(p[i])) {
                            f[i] = 0;
                        }
                    }
                }
            }

            int matches(int k) {

                int matches = 0;

                int j = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i].equals(p[j])) {
                        j++;
                        if (ans[j] == n && i >= k - 1) {
                            ans[j] = i;
                        }
                        if (j == m) {
                            matches++;
                            j = f[j - 1] + 1;
                        }
                    } else {
                        while (j > 0 && !p[j].equals(s[i])) {
                            j = f[j - 1] + 1;
                        }

                        if (p[j].equals(s[i])) {
                            j++;
                            if (ans[j] == n && i >= k - 1) {
                                ans[j] = i;
                            }
                        }
                    }
                }

                return matches;
            }

            void can() {
                boolean[] vis = new boolean[m];

                for (int i = m - 1; i >= 0; i--) {
                    if (!vis[i]) {
                        int p = i;
                        vis[p] = true;
                        int c = f[p];
                        while (c > 0) {
                            ans[c] = Math.min(ans[p], ans[c]);
                            vis[c] = true;
                            p = c;
                            c = f[p];
                        }
                    }
                }
            }

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public String next() {
            return nextString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void print(int i) {
            writer.print(i);
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.stream.IntStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.stream.Stream;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakharjain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        _955D solver = new _955D();
        solver.solve(1, in, out);
        out.close();
    }

    static class _955D {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            int k = in.nextInt();

            String s = in.next();
            String t = in.next();

            Kmp<Character> kmp1 = new Kmp<Character>(
                    s.chars().mapToObj(c -> (char) c).toArray(Character[]::new), t.chars().mapToObj(c -> (char) c).toArray(Character[]::new));

            kmp1.fail();
            kmp1.matches(k);
            kmp1.can();

            String sr = new StringBuilder(s).reverse().toString();
            String tr = new StringBuilder(t).reverse().toString();

            Kmp<Character> kmp2 = new Kmp<Character>(
                    sr.chars().mapToObj(c -> (char) c).toArray(Character[]::new), tr.chars().mapToObj(c -> (char) c).toArray(Character[]::new));

            kmp2.fail();
            kmp2.matches(k);
            kmp2.can();

            for (int i = 0; i <= m; i++) {
                int lai = kmp1.ans[i];

                int rai = kmp2.ans[m - i];

                if (i > k || m - i > k)
                    continue;

                int raia = n - 1 - rai;

                if (i == m && kmp1.sa != n) {
                    lai = Math.max(k - 1, kmp1.sa);
                    raia = n - k;
                } else if (m - i == m && kmp2.sa != n) {
                    lai = 0;
                    raia = Math.min(n - 1 - kmp2.sa, n - k);
                }
                if (lai < raia && lai - k + 1 >= 0 && raia + k - 1 < n) {

                    out.println("Yes");
                    out.print(lai + 1 - k + 1);
                    out.print(" ");
                    out.print(raia + 1);

                    return;
                }
            }

            out.println("No");
        }

        class Kmp<T extends Comparable<T>> {
            T[] s;
            T[] p;
            int n;
            int m;
            int[] f;
            int[] ans;
            int[] ansi;
            int sa;

            public Kmp(T[] s, T[] p) {
                super();
                this.s = s;
                this.p = p;
                this.n = s.length;
                this.m = p.length;
                this.f = new int[m];
                this.ans = new int[n + 1];
                for (int i = 1; i <= n; i++)
                    this.ans[i] = n;
                this.ansi = new int[n];
                this.sa = n;
            }

            void fail() {
                f[0] = -1;

                for (int i = 1; i < m; i++) {
                    int c = f[i - 1];

                    f[i] = -1;
                    while (c > -1) {
                        if (p[c + 1].equals(p[i])) {
                            f[i] = c + 1;
                            break;
                        } else {
                            c = f[c];
                        }
                    }

                    if (f[i] == -1) {
                        if (p[0].equals(p[i])) {
                            f[i] = 0;
                        }
                    }
                }
            }

            int matches(int k) {

                int matches = 0;

                int j = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i].equals(p[j])) {
                        j++;
                        if (ans[j] == n && i >= k - 1) {
                            ans[j] = i;
                        }
                        if (j == m) {
                            if (sa == n) {
                                sa = i;
                            }
                            matches++;
                            j = f[j - 1] + 1;
                        }
                    } else {
                        while (j > 0 && !p[j].equals(s[i])) {
                            j = f[j - 1] + 1;
                        }

                        if (p[j].equals(s[i])) {
                            j++;
                            if (ans[j] == n && i >= k - 1) {
                                ans[j] = i;
                            }
                        }
                    }
                }

                return matches;
            }

            void can() {
                boolean[] vis = new boolean[m + 1];

                for (int i = m; i > 0; i--) {
                    if (!vis[i]) {
                        int p = i;
                        vis[p] = true;
                        int c = f[p - 1] + 1;
                        while (c > 0) {
                            ans[c] = Math.min(ans[p], ans[c]);
                            vis[c] = true;
                            p = c;
                            c = f[p - 1] + 1;
                        }
                    }
                }
            }

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public String next() {
            return nextString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void print(int i) {
            writer.print(i);
        }

    }
}


//package round474;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class D {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni(), m = ni(), K = ni();
		char[] s = ns(n);
		char[] t = ns(m);
		if(m > 2*K){
			out.println("No");
			return;
		}

		char[] rt = Arrays.copyOf(t, m);
		for(int i = 0, j = m-1;i < j;i++,j--){
			char c = rt[i]; rt[i] = rt[j]; rt[j] = c;
		}
		int[] rmp = mpTable(rt);

		int[] last = new int[m+1];
		Arrays.fill(last, -1);
		int p = 0;
		for(int i = 0;i < n;i++){
			while(p >= 0 && rt[p] != s[n-1-i])p = rmp[p];

			++p;
			if(i >= K-1 && last[p] == -1){
				last[p] = n-1-i;
			}
			if(i+K < n){
				if(Math.min(p, K) >= m){
					out.println("Yes");
					out.println(1 + " " + Math.min(n-K+1, n-i));
					int l = 1, r = Math.min(n-K+1, n-i);
					assert l >= 1 && r <= n && l+K <= r;
					return;
				}
			}
			if(p == t.length){
				p = rmp[p];
			}
		}
		last[0] = n-K;

		int[] mp = mpTable(t);
		int[] first = new int[m+1];
		Arrays.fill(first, n+1);
		int o = 0;
		for(int i = 0;i < n;i++){
			while(o >= 0 && t[o] != s[i])o = mp[o];
			++o;

			if(i >= K-1 && first[o] == n+1){
				first[o] = i;
			}
			if(i+K < n){
				if(Math.min(o, K) >= m){
					out.println("Yes");
					out.println(Math.max(1, i-K+1+1) + " " + (n-K+1));
					int l = Math.max(1, i-K+1+1), r = n-K+1;
					assert l >= 1 && r <= n && l+K <= r;
					return;
				}
			}

			if(o == t.length){
				o = mp[o];
			}
		}
		for(int i = m;i > 0;i--){
			int f = rmp[i];
			last[f] = Math.max(last[f], last[i]);
		}
		for(int i = m;i > 0;i--){
			int f = mp[i];
			first[f] = Math.min(first[f], first[i]);
		}
		for(int i = 1;i <= m-1;i++){
			if(i <= K && m-i <= K && first[i] != n+1 && last[m-i] != -1){
				if(first[i] < last[m-i]){
					out.println("Yes");
					out.println(first[i]-K+1+1 + " " + (last[m-i]+1));
					int l = first[i]-K+1+1, r = last[m-i]+1;
					assert l >= 1 && r <= n && l+K <= r;
					return;
				}
			}
		}

		out.println("No");
	}

	public static int[] mpTable(char[] str)
	{
		int n = str.length;
		int[] mp = new int[n+1];
		mp[0] = -1;
		for(int i = 1, j = 0;i < n;i++){
			while(j >= 0 && str[i] != str[j])j = mp[j];
			mp[i+1] = ++j;
		}
		return mp;
	}

	public static int[] Z(char[] str)
	{
		int n = str.length;
		int[] z = new int[n];
		if(n == 0)return z;
		z[0] = n;
		int l = 0, r = 0;
		for(int i = 1;i < n;i++){
			if(i > r){
				l = r = i;
				while(r < n && str[r-l] == str[r])r++;
				z[i] = r-l; r--;
			}else{
				if(z[i-l] < r-i+1){
					z[i] = z[i-l];
				}else{
					l = i;
					while(r < n && str[r-l] == str[r])r++;
					z[i] = r-l; r--;
				}
			}
		}

		return z;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new D().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


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

public class D implements Runnable{
	public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();}

	public void run() {
		long time = System.nanoTime() + (165 * 1000000);
		while(time > System.nanoTime()) {
			//hi!
		}
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		int m = fs.nextInt();
		int k = fs.nextInt();
		String s1 = fs.next(), s2 = fs.next();

		int[] z1 = getZ((s2+"#"+s1).toCharArray());
		int[] z2 = getZ((reverse(s2)+"#"+reverse(s1)).toCharArray());
		z1 = Arrays.copyOfRange(z1, m + 1, z1.length);
		z2 = Arrays.copyOfRange(z2, m + 1, z2.length);

		int[] left = new int[k + 1];
		Num[] a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z1[i], i); Arrays.sort(a);
		left = get(a, k);

		int[] right = new int[k + 1];
		a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z2[i], i); Arrays.sort(a);
		right = get(a, k);

		for(int i = 0; i < n; i++) {
			if(z1[i] == m) {
				if(i + k + k <= n) {
					System.out.printf("Yes\n%d %d\n", i+1, i + k + 1);
					return;
				}
				else if(i - k >= 0 && i + k <= n) {
					System.out.printf("Yes\n%d %d\n", i-k+1, i + 1);
					return;
				}
				else {
					int end = Math.min(n - 1, i + k);
					int ridx = end - k;
					int lidx = ridx - k;
					if(lidx >= 0 && ridx < n) {
						System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
						return;
					}
				}
			}
		}

		for(int tk = 1; tk <= Math.min(m-1, k); tk++) {
			if(left[tk] == -1 || m - tk > k || right[m-tk] == -1) continue;
			int lidx = left[tk]; lidx -= (k - tk);
			int alt = m - tk;
			int ridx = n - right[alt] - 1; ridx -= alt-1;
			if(lidx + k > ridx) continue;
			if(lidx < 0 || ridx < 0) continue;
			if(lidx > n || ridx > n) continue;

			System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
			return;
		}

		System.out.println("No");

		out.close();
	}

	int[] get(Num[] a, int k) {
		int[] left = new int[k + 1];
		TreeSet<Integer> set = new TreeSet<>();
		for(int x = k, ptr = 0; x > 0; x--) {
			while(ptr < a.length && a[ptr].z >= x) {
				if(a[ptr].idx + x >= k) set.add(a[ptr].idx);
				ptr++;
			}
			if(set.isEmpty()) left[x] = -1;
			else {
				Integer hi = set.ceiling(k - x);
				if(hi == null) left[x] = -1;
				else left[x] = hi;
			}
		}
		return left;
	}

	boolean brute(String s, String t, int k) {
		for(int i = 0; i + k <= s.length(); i++) {
			for(int j = i + k; j + k <= s.length(); j++) {
				String s1 = s.substring(i, i + k);
				String s2 = s.substring(j, j + k);
				if((s1+s2).contains(t)) {
					System.out.println((s1+s2));
					System.out.println((i+1) + " , " + (j+1));
					return true;
				}
			}
		}
		return false;
	}

	String reverse(String s) { return new StringBuilder(s).reverse().toString(); }

	void reverse(int[] a) {
		int n = a.length;
		for(int i = 0; i < n / 2; i++) {
			int t = a[i];
			a[i] = a[n - i - 1];
			a[n - i - 1] = t;
		}
	}

	int[] getZ (char[] a) {
		int[] z = new int[a.length];
		int left = 0, right = 0; //left and right bounds for my z box
		for(int k = 1; k < a.length; k++) {
			if(k > right) {
				//we have to do actual comparisons here
				left = right = k;
				while(right < a.length && a[right] == a[right - left]) {
					//while my right pointer is matching the prefix of the string
					right++;
				}
				z[k] = right - left; //the length that was matched
				right--;
			}
			else {
				//reuse values because k lies inside my z box
				int k1 = k - left; //the position that we can reuse
				if(z[k1] < right - k + 1) {
					//the z value for this previous position can't get any more matches so just copy it.
					z[k] = z[k1];
				}
				else {
					//we have to check to see if there are more matches
					left = k;
					while(right < a.length && a[right] == a[right - left]) {
						right++;
					}
					z[k] = right - left;
					right--;
				}
			}
		}
		return z;
	}

	class Num implements Comparable<Num> {
		int z, idx;
		Num(int zz, int i) { z = zz; idx = i; }
		public int compareTo(Num n) { return Integer.compare(n.z, z); }
		public String toString() { return "Idx " + idx + " Z " + z; }
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
//				br = new BufferedReader(new FileReader("testdata.out"));
				st = new StringTokenizer("");
			} catch (Exception e){e.printStackTrace();}
		}
		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			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 String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}
		public Integer[] nextIntegerArray(int n) {
			Integer[] a = new Integer[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public char[] nextCharArray() {return nextLine().toCharArray();}
	}

}


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

public class D2 implements Runnable{
	public static void main (String[] args) {new Thread(null, new D2(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		int m = fs.nextInt();
		int k = fs.nextInt();
		String s1 = fs.next();
		String s2 = fs.next();
		int[] z1 = getZ((rev(s2) + "#" + rev(s1)).toCharArray());
		int[] z2 = getZ((s2 + "#" + s1).toCharArray());

		z1 = Arrays.copyOfRange(z1, m+1, z1.length);
		z2 = Arrays.copyOfRange(z2, m+1, z2.length);

//		System.out.println(z1.length + " " + z2.length);

		int[] maxStart = new int[n];
		int[] maxEnd = new int[n];

		int cur = 0;
		for(int i = 0; i < z1.length; i++) {
			cur = Math.max(cur, z1[i]);

			maxStart[i] = Math.max(z1[i], cur);

			cur--;
			cur = Math.max(0, cur);
		}

		maxStart = reverse(maxStart);

		cur = 0;
		for(int i = 0; i < n; i++) {
			cur = Math.max(cur, z2[i]);

			maxEnd[i] = Math.max(z2[i], cur);

			cur--; cur = Math.max(0, cur);
		}

		int maxlog = Integer.numberOfTrailingZeros(Integer.highestOneBit(n)) + 2;
		int[][] liftZ2 = new int[maxlog][n];
		int[][] liftZ1 = new int[maxlog][n];

		for (int i = 0; i < n; i++)
			liftZ2[0][i] = maxEnd[i];
		int lastRange = 1;
		for (int lg = 1; lg < maxlog; lg++) {
			Arrays.fill(liftZ2[lg], -1);
			for (int i = 0; i < n; i++) {
//				if(i + lastRange > n) break;
//				System.out.println("wtf? " + i + " " + lg);
				liftZ2[lg][i] = Math.max(liftZ2[lg - 1][i], liftZ2[lg - 1][Math.min(i + lastRange, n - 1)]);
			}
			lastRange *= 2;
		}

//		for (int i = 0; i < n; i++)
//			liftZ1[0][i] = maxStart[i];
//		lastRange = 1;
//		for (int lg = 1; lg < maxlog; lg++) {
//			Arrays.fill(liftZ1[lg], -1);
//			for (int i = 0; i < n; i++) {
//				if(i + lastRange > n) break;
//				liftZ1[lg][i] = Math.max(liftZ1[lg - 1][i], liftZ1[lg - 1][Math.min(i + lastRange, n - 1)]);
//			}
//			lastRange *= 2;
//		}

		for(int i = 0; i < n; i++) {
			if(i + k + k > n) break;

			int left = i, right = i + k - 1;
			int got = maxStart[right];
			int need = m - got;

//			System.out.println(left + " " + got + " " + need);

			int query = query(right + 1, n - 1, liftZ2);
//			System.out.println("Q " + query);
			if(query < need) continue;
			if(need > k) continue;

			//find it! and it needs to be as small as possible!

			int at = right + 1;
			for(int p = maxlog - 1; p >= 0; p--) {
				if(liftZ2[p][at] == -1) continue;
				if(liftZ2[p][at] >= need) continue;
				else {
					at += 1 << p;
					p++;
				}
			}

//			System.out.println(query + " " + at);

			if(at + k > n) {
				at -= (k - liftZ2[0][at]);
				if(at < 0 || at < right) continue;
			}
			System.out.println("Yes");
			System.out.printf("%d %d\n", left+1, at+1);
			return;

		}

		System.out.println("No");
		out.close();
	}

	public int query(int low, int hi, int[][] sparse) {
		int range = hi - low + 1;
		int exp = Integer.highestOneBit(range);
		int lg = Integer.numberOfTrailingZeros(exp);
		return Math.max(sparse[lg][low], sparse[lg][hi - exp + 1]);
	}

	String rev(String s) {
		return new StringBuilder(s).reverse().toString();
	}

	int[] reverse(int[] a) {
		for(int i = 0; i < a.length / 2; i++) {
			int t = a[i];
			a[i] = a[a.length - i - 1];
			a[a.length - i - 1] = t;
		}
		return a;
	}

	int[] getZ (char[] a) {
		int[] z = new int[a.length];
		int left = 0, right = 0; //left and right bounds for my z box
		for(int k = 1; k < a.length; k++) {
			if(k > right) {
				//we have to do actual comparisons here
				left = right = k;
				while(right < a.length && a[right] == a[right - left]) {
					//while my right pointer is matching the prefix of the string
					right++;
				}
				z[k] = right - left; //the length that was matched
				right--;
			}
			else {
				//reuse values because k lies inside my z box
				int k1 = k - left; //the position that we can reuse
				if(z[k1] < right - k + 1) {
					//the z value for this previous position can't get any more matches so just copy it.
					z[k] = z[k1];
				}
				else {
					//we have to check to see if there are more matches
					left = k;
					while(right < a.length && a[right] == a[right - left]) {
						right++;
					}
					z[k] = right - left;
					right--;
				}
			}
		}
		return z;
	}

	void sort (int[] a) {
		int n = a.length;
		for(int i = 0; i < 50; i++) {
			Random r = new Random();
			int x = r.nextInt(n), y = r.nextInt(n);
			int temp = a[x];
			a[x] = a[y];
			a[y] = temp;
		}
		Arrays.sort(a);
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				//                br = new BufferedReader(new FileReader("testdata.out"));
				st = new StringTokenizer("");
			} catch (Exception e){e.printStackTrace();}
		}
		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			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 String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}
		public Integer[] nextIntegerArray(int n) {
			Integer[] a = new Integer[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public char[] nextCharArray() {return nextLine().toCharArray();}
	}

}


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

public class D implements Runnable{
	public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();}

	public void run() {
//		try { new TestGenerator(); } catch (Exception e) {}
		try { Thread.sleep(500); } catch (InterruptedException e) {}
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		int m = fs.nextInt();
		int k = fs.nextInt();
		String s1 = fs.next(), s2 = fs.next();

//		System.out.println("Brute " + brute(s1, s2, k) + "\n");

		int[] z1 = getZ((s2+"#"+s1).toCharArray());
		int[] z2 = getZ((reverse(s2)+"#"+reverse(s1)).toCharArray());
		z1 = Arrays.copyOfRange(z1, m + 1, z1.length);
		z2 = Arrays.copyOfRange(z2, m + 1, z2.length);

		//		System.out.println(Arrays.toString(z1));
		//		System.out.println(Arrays.toString(z2));

		int[] left = new int[k + 1];
		Num[] a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z1[i], i); Arrays.sort(a);
		left = get(a, k);

		int[] right = new int[k + 1];
		a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z2[i], i); Arrays.sort(a);
		right = get(a, k);

		//		System.out.println(Arrays.toString(left));
		//		System.out.println(Arrays.toString(right));

		for(int i = 0; i < n; i++) {
			if(z1[i] == m) {
				if(i + k + k <= n) {
					System.out.printf("Yes\n%d %d\n", i+1, i + k + 1);
					return;
				}
				else if(i - k >= 0 && i + k <= n) {
					System.out.printf("Yes\n%d %d\n", i-k+1, i + 1);
					return;
				}
				else {
					int end = Math.min(n - 1, i + k);
					int ridx = end - k;
					int lidx = ridx - k;
					if(lidx >= 0 && ridx < n) {
						System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
						return;
					}
				}
			}
		}

		for(int tk = 1; tk <= Math.min(m-1, k); tk++) {
			if(left[tk] == -1 || m - tk > k || right[m-tk] == -1) continue;
			int lidx = left[tk]; lidx -= (k - tk);
			int alt = m - tk;
			int ridx = n - right[alt] - 1; ridx -= alt-1;
			if(lidx + k > ridx) continue;
			if(lidx < 0 || ridx < 0) continue;
			if(lidx > n || ridx > n) continue;

			System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
			return;
		}

		System.out.println("No");

		out.close();
	}

	int[] get(Num[] a, int k) {
		int[] left = new int[k + 1];
		TreeSet<Integer> set = new TreeSet<>();
		for(int x = k, ptr = 0; x > 0; x--) {
			while(ptr < a.length && a[ptr].z >= x) {
				if(a[ptr].idx + x >= k) set.add(a[ptr].idx);
				ptr++;
			}
			if(set.isEmpty()) left[x] = -1;
			else {
				Integer hi = set.ceiling(k - x);
				if(hi == null) left[x] = -1;
				else left[x] = hi;
			}
		}
		return left;
	}

	boolean brute(String s, String t, int k) {
		for(int i = 0; i + k <= s.length(); i++) {
			for(int j = i + k; j + k <= s.length(); j++) {
				String s1 = s.substring(i, i + k);
				String s2 = s.substring(j, j + k);
				if((s1+s2).contains(t)) {
					System.out.println((s1+s2));
					System.out.println((i+1) + " , " + (j+1));
					return true;
				}
			}
		}
		return false;
	}

	String reverse(String s) { return new StringBuilder(s).reverse().toString(); }

	void reverse(int[] a) {
		int n = a.length;
		for(int i = 0; i < n / 2; i++) {
			int t = a[i];
			a[i] = a[n - i - 1];
			a[n - i - 1] = t;
		}
	}

	int[] getZ (char[] a) {
		int[] z = new int[a.length];
		int left = 0, right = 0; //left and right bounds for my z box
		for(int k = 1; k < a.length; k++) {
			if(k > right) {
				//we have to do actual comparisons here
				left = right = k;
				while(right < a.length && a[right] == a[right - left]) {
					//while my right pointer is matching the prefix of the string
					right++;
				}
				z[k] = right - left; //the length that was matched
				right--;
			}
			else {
				//reuse values because k lies inside my z box
				int k1 = k - left; //the position that we can reuse
				if(z[k1] < right - k + 1) {
					//the z value for this previous position can't get any more matches so just copy it.
					z[k] = z[k1];
				}
				else {
					//we have to check to see if there are more matches
					left = k;
					while(right < a.length && a[right] == a[right - left]) {
						right++;
					}
					z[k] = right - left;
					right--;
				}
			}
		}
		return z;
	}

	class Num implements Comparable<Num> {
		int z, idx;
		Num(int zz, int i) { z = zz; idx = i; }
		public int compareTo(Num n) { return Integer.compare(n.z, z); }
		public String toString() { return "Idx " + idx + " Z " + z; }
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
//				br = new BufferedReader(new FileReader("testdata.out"));
				st = new StringTokenizer("");
			} catch (Exception e){e.printStackTrace();}
		}
		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			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 String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}
		public Integer[] nextIntegerArray(int n) {
			Integer[] a = new Integer[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public char[] nextCharArray() {return nextLine().toCharArray();}
	}

}


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

public class D implements Runnable{
	public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();}

	public void run() {
		long time = System.nanoTime() + (160 * 1000000);
		while(time > System.nanoTime()) {
			//hi!
		}
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		int m = fs.nextInt();
		int k = fs.nextInt();
		String s1 = fs.next(), s2 = fs.next();

		int[] z1 = getZ((s2+"#"+s1).toCharArray());
		int[] z2 = getZ((reverse(s2)+"#"+reverse(s1)).toCharArray());
		z1 = Arrays.copyOfRange(z1, m + 1, z1.length);
		z2 = Arrays.copyOfRange(z2, m + 1, z2.length);

		int[] left = new int[k + 1];
		Num[] a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z1[i], i); Arrays.sort(a);
		left = get(a, k);

		int[] right = new int[k + 1];
		a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z2[i], i); Arrays.sort(a);
		right = get(a, k);

		for(int i = 0; i < n; i++) {
			if(z1[i] == m) {
				if(i + k + k <= n) {
					System.out.printf("Yes\n%d %d\n", i+1, i + k + 1);
					return;
				}
				else if(i - k >= 0 && i + k <= n) {
					System.out.printf("Yes\n%d %d\n", i-k+1, i + 1);
					return;
				}
				else {
					int end = Math.min(n - 1, i + k);
					int ridx = end - k;
					int lidx = ridx - k;
					if(lidx >= 0 && ridx < n) {
						System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
						return;
					}
				}
			}
		}

		for(int tk = 1; tk <= Math.min(m-1, k); tk++) {
			if(left[tk] == -1 || m - tk > k || right[m-tk] == -1) continue;
			int lidx = left[tk]; lidx -= (k - tk);
			int alt = m - tk;
			int ridx = n - right[alt] - 1; ridx -= alt-1;
			if(lidx + k > ridx) continue;
			if(lidx < 0 || ridx < 0) continue;
			if(lidx > n || ridx > n) continue;

			System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
			return;
		}

		System.out.println("No");

		out.close();
	}

	int[] get(Num[] a, int k) {
		int[] left = new int[k + 1];
		TreeSet<Integer> set = new TreeSet<>();
		for(int x = k, ptr = 0; x > 0; x--) {
			while(ptr < a.length && a[ptr].z >= x) {
				if(a[ptr].idx + x >= k) set.add(a[ptr].idx);
				ptr++;
			}
			if(set.isEmpty()) left[x] = -1;
			else {
				Integer hi = set.ceiling(k - x);
				if(hi == null) left[x] = -1;
				else left[x] = hi;
			}
		}
		return left;
	}

	boolean brute(String s, String t, int k) {
		for(int i = 0; i + k <= s.length(); i++) {
			for(int j = i + k; j + k <= s.length(); j++) {
				String s1 = s.substring(i, i + k);
				String s2 = s.substring(j, j + k);
				if((s1+s2).contains(t)) {
					System.out.println((s1+s2));
					System.out.println((i+1) + " , " + (j+1));
					return true;
				}
			}
		}
		return false;
	}

	String reverse(String s) { return new StringBuilder(s).reverse().toString(); }

	void reverse(int[] a) {
		int n = a.length;
		for(int i = 0; i < n / 2; i++) {
			int t = a[i];
			a[i] = a[n - i - 1];
			a[n - i - 1] = t;
		}
	}

	int[] getZ (char[] a) {
		int[] z = new int[a.length];
		int left = 0, right = 0; //left and right bounds for my z box
		for(int k = 1; k < a.length; k++) {
			if(k > right) {
				//we have to do actual comparisons here
				left = right = k;
				while(right < a.length && a[right] == a[right - left]) {
					//while my right pointer is matching the prefix of the string
					right++;
				}
				z[k] = right - left; //the length that was matched
				right--;
			}
			else {
				//reuse values because k lies inside my z box
				int k1 = k - left; //the position that we can reuse
				if(z[k1] < right - k + 1) {
					//the z value for this previous position can't get any more matches so just copy it.
					z[k] = z[k1];
				}
				else {
					//we have to check to see if there are more matches
					left = k;
					while(right < a.length && a[right] == a[right - left]) {
						right++;
					}
					z[k] = right - left;
					right--;
				}
			}
		}
		return z;
	}

	class Num implements Comparable<Num> {
		int z, idx;
		Num(int zz, int i) { z = zz; idx = i; }
		public int compareTo(Num n) { return Integer.compare(n.z, z); }
		public String toString() { return "Idx " + idx + " Z " + z; }
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
//				br = new BufferedReader(new FileReader("testdata.out"));
				st = new StringTokenizer("");
			} catch (Exception e){e.printStackTrace();}
		}
		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			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 String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}
		public Integer[] nextIntegerArray(int n) {
			Integer[] a = new Integer[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public char[] nextCharArray() {return nextLine().toCharArray();}
	}

}


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

public class D implements Runnable{
	public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();}

	public void run() {
		long time = System.nanoTime() + (175 * 1000000);
		while(time > System.nanoTime()) {
			//hi!
		}
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		int m = fs.nextInt();
		int k = fs.nextInt();
		String s1 = fs.next(), s2 = fs.next();

		int[] z1 = getZ((s2+"#"+s1).toCharArray());
		int[] z2 = getZ((reverse(s2)+"#"+reverse(s1)).toCharArray());
		z1 = Arrays.copyOfRange(z1, m + 1, z1.length);
		z2 = Arrays.copyOfRange(z2, m + 1, z2.length);

		int[] left = new int[k + 1];
		Num[] a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z1[i], i); Arrays.sort(a);
		left = get(a, k);

		int[] right = new int[k + 1];
		a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z2[i], i); Arrays.sort(a);
		right = get(a, k);

		for(int i = 0; i < n; i++) {
			if(z1[i] == m) {
				if(i + k + k <= n) {
					System.out.printf("Yes\n%d %d\n", i+1, i + k + 1);
					return;
				}
				else if(i - k >= 0 && i + k <= n) {
					System.out.printf("Yes\n%d %d\n", i-k+1, i + 1);
					return;
				}
				else {
					int end = Math.min(n - 1, i + k);
					int ridx = end - k;
					int lidx = ridx - k;
					if(lidx >= 0 && ridx < n) {
						System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
						return;
					}
				}
			}
		}

		for(int tk = 1; tk <= Math.min(m-1, k); tk++) {
			if(left[tk] == -1 || m - tk > k || right[m-tk] == -1) continue;
			int lidx = left[tk]; lidx -= (k - tk);
			int alt = m - tk;
			int ridx = n - right[alt] - 1; ridx -= alt-1;
			if(lidx + k > ridx) continue;
			if(lidx < 0 || ridx < 0) continue;
			if(lidx > n || ridx > n) continue;

			System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
			return;
		}

		System.out.println("No");

		out.close();
	}

	int[] get(Num[] a, int k) {
		int[] left = new int[k + 1];
		TreeSet<Integer> set = new TreeSet<>();
		for(int x = k, ptr = 0; x > 0; x--) {
			while(ptr < a.length && a[ptr].z >= x) {
				if(a[ptr].idx + x >= k) set.add(a[ptr].idx);
				ptr++;
			}
			if(set.isEmpty()) left[x] = -1;
			else {
				Integer hi = set.ceiling(k - x);
				if(hi == null) left[x] = -1;
				else left[x] = hi;
			}
		}
		return left;
	}

	boolean brute(String s, String t, int k) {
		for(int i = 0; i + k <= s.length(); i++) {
			for(int j = i + k; j + k <= s.length(); j++) {
				String s1 = s.substring(i, i + k);
				String s2 = s.substring(j, j + k);
				if((s1+s2).contains(t)) {
					System.out.println((s1+s2));
					System.out.println((i+1) + " , " + (j+1));
					return true;
				}
			}
		}
		return false;
	}

	String reverse(String s) { return new StringBuilder(s).reverse().toString(); }

	void reverse(int[] a) {
		int n = a.length;
		for(int i = 0; i < n / 2; i++) {
			int t = a[i];
			a[i] = a[n - i - 1];
			a[n - i - 1] = t;
		}
	}

	int[] getZ (char[] a) {
		int[] z = new int[a.length];
		int left = 0, right = 0; //left and right bounds for my z box
		for(int k = 1; k < a.length; k++) {
			if(k > right) {
				//we have to do actual comparisons here
				left = right = k;
				while(right < a.length && a[right] == a[right - left]) {
					//while my right pointer is matching the prefix of the string
					right++;
				}
				z[k] = right - left; //the length that was matched
				right--;
			}
			else {
				//reuse values because k lies inside my z box
				int k1 = k - left; //the position that we can reuse
				if(z[k1] < right - k + 1) {
					//the z value for this previous position can't get any more matches so just copy it.
					z[k] = z[k1];
				}
				else {
					//we have to check to see if there are more matches
					left = k;
					while(right < a.length && a[right] == a[right - left]) {
						right++;
					}
					z[k] = right - left;
					right--;
				}
			}
		}
		return z;
	}

	class Num implements Comparable<Num> {
		int z, idx;
		Num(int zz, int i) { z = zz; idx = i; }
		public int compareTo(Num n) { return Integer.compare(n.z, z); }
		public String toString() { return "Idx " + idx + " Z " + z; }
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
//				br = new BufferedReader(new FileReader("testdata.out"));
				st = new StringTokenizer("");
			} catch (Exception e){e.printStackTrace();}
		}
		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			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 String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}
		public Integer[] nextIntegerArray(int n) {
			Integer[] a = new Integer[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public char[] nextCharArray() {return nextLine().toCharArray();}
	}

}


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

public class D implements Runnable{
	public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		int m = fs.nextInt();
		int k = fs.nextInt();
		String s1 = fs.next();
		String s2 = fs.next();
		int[] z1 = getZ((s2 + "#" + s1).toCharArray());
		z1 = Arrays.copyOfRange(z1, m + 1, z1.length);
		int[] z2 = getZ((rev(s2) + "#" + s1).toCharArray());
		z2 = Arrays.copyOfRange(z2, m + 1, z2.length);
		TreeSet<Integer>[] adj = new TreeSet[n];
		for(int i = 0; i < adj.length; i++) adj[i] = new TreeSet<>();
		for(int i = 0; i < z2.length; i++) {
			adj[z2[i]].add(i);
		}

		for(int i = 0; i < n; i++) {
			int f = z1[i];
			int sidx = i;
			if(f > k) {
				f = k;
			}
			if(f < k) {
				sidx -= k - f;
				if(sidx < 0) continue;
			}
			int need = m - f;

			Integer get = adj[need].higher(sidx + k - 1);
			if(get != null && get + k >= n) {
				System.out.println("Yes");
				System.out.print(sidx+1);
				System.out.println(" " + (get+1));
				return;
			}

		}

		System.out.println("No");

		out.close();
	}

	String rev(String s) {
		return new StringBuilder(s).reverse().toString();
	}

	int[] getZ (char[] a) {
		int[] z = new int[a.length];
		int left = 0, right = 0; //left and right bounds for my z box
		for(int k = 1; k < a.length; k++) {
			if(k > right) {
				//we have to do actual comparisons here
				left = right = k;
				while(right < a.length && a[right] == a[right - left]) {
					//while my right pointer is matching the prefix of the string
					right++;
				}
				z[k] = right - left; //the length that was matched
				right--;
			}
			else {
				//reuse values because k lies inside my z box
				int k1 = k - left; //the position that we can reuse
				if(z[k1] < right - k + 1) {
					//the z value for this previous position can't get any more matches so just copy it.
					z[k] = z[k1];
				}
				else {
					//we have to check to see if there are more matches
					left = k;
					while(right < a.length && a[right] == a[right - left]) {
						right++;
					}
					z[k] = right - left;
					right--;
				}
			}
		}
		return z;
	}

	void sort (int[] a) {
		int n = a.length;
		for(int i = 0; i < 50; i++) {
			Random r = new Random();
			int x = r.nextInt(n), y = r.nextInt(n);
			int temp = a[x];
			a[x] = a[y];
			a[y] = temp;
		}
		Arrays.sort(a);
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				//                br = new BufferedReader(new FileReader("testdata.out"));
				st = new StringTokenizer("");
			} catch (Exception e){e.printStackTrace();}
		}
		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			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 String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}
		public Integer[] nextIntegerArray(int n) {
			Integer[] a = new Integer[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public char[] nextCharArray() {return nextLine().toCharArray();}
	}

}


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

public class D implements Runnable{
	public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();}

	public void run() {
//		try { new TestGenerator(); } catch (Exception e) {}
//		try { Thread.sleep(500); } catch (InterruptedException e) {}
		long time = System.nanoTime() + (50 * 1000000);
		while(time > System.nanoTime()) {
			//hi!
		}
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		int m = fs.nextInt();
		int k = fs.nextInt();
		String s1 = fs.next(), s2 = fs.next();

//		System.out.println("Brute " + brute(s1, s2, k) + "\n");

		int[] z1 = getZ((s2+"#"+s1).toCharArray());
		int[] z2 = getZ((reverse(s2)+"#"+reverse(s1)).toCharArray());
		z1 = Arrays.copyOfRange(z1, m + 1, z1.length);
		z2 = Arrays.copyOfRange(z2, m + 1, z2.length);

		//		System.out.println(Arrays.toString(z1));
		//		System.out.println(Arrays.toString(z2));

		int[] left = new int[k + 1];
		Num[] a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z1[i], i); Arrays.sort(a);
		left = get(a, k);

		int[] right = new int[k + 1];
		a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z2[i], i); Arrays.sort(a);
		right = get(a, k);

		//		System.out.println(Arrays.toString(left));
		//		System.out.println(Arrays.toString(right));

		for(int i = 0; i < n; i++) {
			if(z1[i] == m) {
				if(i + k + k <= n) {
					System.out.printf("Yes\n%d %d\n", i+1, i + k + 1);
					return;
				}
				else if(i - k >= 0 && i + k <= n) {
					System.out.printf("Yes\n%d %d\n", i-k+1, i + 1);
					return;
				}
				else {
					int end = Math.min(n - 1, i + k);
					int ridx = end - k;
					int lidx = ridx - k;
					if(lidx >= 0 && ridx < n) {
						System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
						return;
					}
				}
			}
		}

		for(int tk = 1; tk <= Math.min(m-1, k); tk++) {
			if(left[tk] == -1 || m - tk > k || right[m-tk] == -1) continue;
			int lidx = left[tk]; lidx -= (k - tk);
			int alt = m - tk;
			int ridx = n - right[alt] - 1; ridx -= alt-1;
			if(lidx + k > ridx) continue;
			if(lidx < 0 || ridx < 0) continue;
			if(lidx > n || ridx > n) continue;

			System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
			return;
		}

		System.out.println("No");

		out.close();
	}

	int[] get(Num[] a, int k) {
		int[] left = new int[k + 1];
		TreeSet<Integer> set = new TreeSet<>();
		for(int x = k, ptr = 0; x > 0; x--) {
			while(ptr < a.length && a[ptr].z >= x) {
				if(a[ptr].idx + x >= k) set.add(a[ptr].idx);
				ptr++;
			}
			if(set.isEmpty()) left[x] = -1;
			else {
				Integer hi = set.ceiling(k - x);
				if(hi == null) left[x] = -1;
				else left[x] = hi;
			}
		}
		return left;
	}

	boolean brute(String s, String t, int k) {
		for(int i = 0; i + k <= s.length(); i++) {
			for(int j = i + k; j + k <= s.length(); j++) {
				String s1 = s.substring(i, i + k);
				String s2 = s.substring(j, j + k);
				if((s1+s2).contains(t)) {
					System.out.println((s1+s2));
					System.out.println((i+1) + " , " + (j+1));
					return true;
				}
			}
		}
		return false;
	}

	String reverse(String s) { return new StringBuilder(s).reverse().toString(); }

	void reverse(int[] a) {
		int n = a.length;
		for(int i = 0; i < n / 2; i++) {
			int t = a[i];
			a[i] = a[n - i - 1];
			a[n - i - 1] = t;
		}
	}

	int[] getZ (char[] a) {
		int[] z = new int[a.length];
		int left = 0, right = 0; //left and right bounds for my z box
		for(int k = 1; k < a.length; k++) {
			if(k > right) {
				//we have to do actual comparisons here
				left = right = k;
				while(right < a.length && a[right] == a[right - left]) {
					//while my right pointer is matching the prefix of the string
					right++;
				}
				z[k] = right - left; //the length that was matched
				right--;
			}
			else {
				//reuse values because k lies inside my z box
				int k1 = k - left; //the position that we can reuse
				if(z[k1] < right - k + 1) {
					//the z value for this previous position can't get any more matches so just copy it.
					z[k] = z[k1];
				}
				else {
					//we have to check to see if there are more matches
					left = k;
					while(right < a.length && a[right] == a[right - left]) {
						right++;
					}
					z[k] = right - left;
					right--;
				}
			}
		}
		return z;
	}

	class Num implements Comparable<Num> {
		int z, idx;
		Num(int zz, int i) { z = zz; idx = i; }
		public int compareTo(Num n) { return Integer.compare(n.z, z); }
		public String toString() { return "Idx " + idx + " Z " + z; }
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
//				br = new BufferedReader(new FileReader("testdata.out"));
				st = new StringTokenizer("");
			} catch (Exception e){e.printStackTrace();}
		}
		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			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 String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}
		public Integer[] nextIntegerArray(int n) {
			Integer[] a = new Integer[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public char[] nextCharArray() {return nextLine().toCharArray();}
	}

}


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

public class D implements Runnable{
	public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();}

	public void run() {
		long time = System.nanoTime() + (170 * 1000000);
		while(time > System.nanoTime()) {
			//hi!
		}
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		int m = fs.nextInt();
		int k = fs.nextInt();
		String s1 = fs.next(), s2 = fs.next();

		int[] z1 = getZ((s2+"#"+s1).toCharArray());
		int[] z2 = getZ((reverse(s2)+"#"+reverse(s1)).toCharArray());
		z1 = Arrays.copyOfRange(z1, m + 1, z1.length);
		z2 = Arrays.copyOfRange(z2, m + 1, z2.length);

		int[] left = new int[k + 1];
		Num[] a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z1[i], i); Arrays.sort(a);
		left = get(a, k);

		int[] right = new int[k + 1];
		a = new Num[n]; for(int i = 0; i < n; i++) a[i] = new Num(z2[i], i); Arrays.sort(a);
		right = get(a, k);

		for(int i = 0; i < n; i++) {
			if(z1[i] == m) {
				if(i + k + k <= n) {
					System.out.printf("Yes\n%d %d\n", i+1, i + k + 1);
					return;
				}
				else if(i - k >= 0 && i + k <= n) {
					System.out.printf("Yes\n%d %d\n", i-k+1, i + 1);
					return;
				}
				else {
					int end = Math.min(n - 1, i + k);
					int ridx = end - k;
					int lidx = ridx - k;
					if(lidx >= 0 && ridx < n) {
						System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
						return;
					}
				}
			}
		}

		for(int tk = 1; tk <= Math.min(m-1, k); tk++) {
			if(left[tk] == -1 || m - tk > k || right[m-tk] == -1) continue;
			int lidx = left[tk]; lidx -= (k - tk);
			int alt = m - tk;
			int ridx = n - right[alt] - 1; ridx -= alt-1;
			if(lidx + k > ridx) continue;
			if(lidx < 0 || ridx < 0) continue;
			if(lidx > n || ridx > n) continue;

			System.out.printf("Yes\n%d %d\n", lidx+1, ridx+1);
			return;
		}

		System.out.println("No");

		out.close();
	}

	int[] get(Num[] a, int k) {
		int[] left = new int[k + 1];
		TreeSet<Integer> set = new TreeSet<>();
		for(int x = k, ptr = 0; x > 0; x--) {
			while(ptr < a.length && a[ptr].z >= x) {
				if(a[ptr].idx + x >= k) set.add(a[ptr].idx);
				ptr++;
			}
			if(set.isEmpty()) left[x] = -1;
			else {
				Integer hi = set.ceiling(k - x);
				if(hi == null) left[x] = -1;
				else left[x] = hi;
			}
		}
		return left;
	}

	boolean brute(String s, String t, int k) {
		for(int i = 0; i + k <= s.length(); i++) {
			for(int j = i + k; j + k <= s.length(); j++) {
				String s1 = s.substring(i, i + k);
				String s2 = s.substring(j, j + k);
				if((s1+s2).contains(t)) {
					System.out.println((s1+s2));
					System.out.println((i+1) + " , " + (j+1));
					return true;
				}
			}
		}
		return false;
	}

	String reverse(String s) { return new StringBuilder(s).reverse().toString(); }

	void reverse(int[] a) {
		int n = a.length;
		for(int i = 0; i < n / 2; i++) {
			int t = a[i];
			a[i] = a[n - i - 1];
			a[n - i - 1] = t;
		}
	}

	int[] getZ (char[] a) {
		int[] z = new int[a.length];
		int left = 0, right = 0; //left and right bounds for my z box
		for(int k = 1; k < a.length; k++) {
			if(k > right) {
				//we have to do actual comparisons here
				left = right = k;
				while(right < a.length && a[right] == a[right - left]) {
					//while my right pointer is matching the prefix of the string
					right++;
				}
				z[k] = right - left; //the length that was matched
				right--;
			}
			else {
				//reuse values because k lies inside my z box
				int k1 = k - left; //the position that we can reuse
				if(z[k1] < right - k + 1) {
					//the z value for this previous position can't get any more matches so just copy it.
					z[k] = z[k1];
				}
				else {
					//we have to check to see if there are more matches
					left = k;
					while(right < a.length && a[right] == a[right - left]) {
						right++;
					}
					z[k] = right - left;
					right--;
				}
			}
		}
		return z;
	}

	class Num implements Comparable<Num> {
		int z, idx;
		Num(int zz, int i) { z = zz; idx = i; }
		public int compareTo(Num n) { return Integer.compare(n.z, z); }
		public String toString() { return "Idx " + idx + " Z " + z; }
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
//				br = new BufferedReader(new FileReader("testdata.out"));
				st = new StringTokenizer("");
			} catch (Exception e){e.printStackTrace();}
		}
		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			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 String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}
		public Integer[] nextIntegerArray(int n) {
			Integer[] a = new Integer[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public char[] nextCharArray() {return nextLine().toCharArray();}
	}

}


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

public class D implements Runnable{
	public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		int m = fs.nextInt();
		int k = fs.nextInt();
		String s1 = fs.next();
		String s2 = fs.next();
		int[] z1 = getZ((s2 + "#" + s1).toCharArray());
		z1 = Arrays.copyOfRange(z1, m + 1, z1.length);
		int[] z2 = getZ((rev(s2) + "#" + s1).toCharArray());
		z2 = Arrays.copyOfRange(z2, m + 1, z2.length);

//		System.out.println(Arrays.toString(z1));
//		System.out.println(Arrays.toString(z2));

		int maxLog = Integer.numberOfTrailingZeros(Integer.highestOneBit(n) * 2);
		int[][] sparse = new int[maxLog][n];
		for(int i = 0; i < n; i++) {
			sparse[0][i] = z2[i];
		}
		int lastRange = 1;
		for(int i = 1; i < maxLog; i++) {
			for(int j = 0; j < n; j++) {
				sparse[i][j] = Math.max(sparse[i-1][j], sparse[i-1][Math.min(j + lastRange, n-1)]);
			}
			lastRange *= 2;
		}

		for(int i = 0; i < n; i++) {
			if(z1[i] == m) {

				int alt = i - k;
				if(alt < 0) continue;
				System.out.println("Yes");
				System.out.print(alt+1 + " ");
				System.out.println(i+1);
				return;
			}
		}

		int idx = -1;
		int right = -1;
		for(int i = 0; i < n; i++) {
			int f = z1[i];
			int sidx = i;
			if(f > k) {
				f = k;
			}
			if(f < k) {
				sidx -= k - f;
				if(sidx < 0) continue;
			}
			int need = m - f;

			if(need > k) continue;
//			System.out.println("I " + i);
//			System.out.println(f + " " + need);

			int left = n - (sidx + k);
			if(left < k) continue;

			int max = query(sidx + k, n-1, sparse);
//			System.out.println("L " + left + " " + max);
			if(max >= need) {

				//maybe

				int at = sidx + k;
				for(int p = maxLog - 1; p >= 0; p--) {
					if(sparse[p][at] >= need) {
						continue;
					}
					else {
						at += 1 << p;
					}
				}

				if(at + k > n) continue;

				idx = sidx;
				right = at;

				break;
			}

		}

		if(idx < 0)
			System.out.println("No");
		else {
			System.out.println("Yes");
			System.out.printf("%d %d\n", idx+1, right+1);
		}

		out.close();
	}

	public int query(int low, int hi, int[][] sparse) {
		int range = hi - low + 1;
		int exp = Integer.highestOneBit(range);
		int lg = Integer.numberOfTrailingZeros(exp);
		return Math.max(sparse[lg][low], sparse[lg][hi - exp + 1]);
	}

	String rev(String s) {
		return new StringBuilder(s).reverse().toString();
	}

	int[] getZ (char[] a) {
		int[] z = new int[a.length];
		int left = 0, right = 0; //left and right bounds for my z box
		for(int k = 1; k < a.length; k++) {
			if(k > right) {
				//we have to do actual comparisons here
				left = right = k;
				while(right < a.length && a[right] == a[right - left]) {
					//while my right pointer is matching the prefix of the string
					right++;
				}
				z[k] = right - left; //the length that was matched
				right--;
			}
			else {
				//reuse values because k lies inside my z box
				int k1 = k - left; //the position that we can reuse
				if(z[k1] < right - k + 1) {
					//the z value for this previous position can't get any more matches so just copy it.
					z[k] = z[k1];
				}
				else {
					//we have to check to see if there are more matches
					left = k;
					while(right < a.length && a[right] == a[right - left]) {
						right++;
					}
					z[k] = right - left;
					right--;
				}
			}
		}
		return z;
	}

	void sort (int[] a) {
		int n = a.length;
		for(int i = 0; i < 50; i++) {
			Random r = new Random();
			int x = r.nextInt(n), y = r.nextInt(n);
			int temp = a[x];
			a[x] = a[y];
			a[y] = temp;
		}
		Arrays.sort(a);
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				//                br = new BufferedReader(new FileReader("testdata.out"));
				st = new StringTokenizer("");
			} catch (Exception e){e.printStackTrace();}
		}
		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			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 String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}
		public Integer[] nextIntegerArray(int n) {
			Integer[] a = new Integer[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public char[] nextCharArray() {return nextLine().toCharArray();}
	}

}


 ////////////////////////////////////////BatTle rOweL ///////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define smackie ios_base::sync_with_stdio(0); cin.tie(0);
#define int long long int
#define endl '\n'
#define mset(a,k) memset(a,k,sizeof(a))
#define rep(i,l,h) for(int i=l;i<h;i++)
#define ds1(i,x) for(int  i=0;i<x.size();i++)
void in(int *a,int n){rep(i,0,n){cin>>a[i];}}
typedef vector<int>  vit;
typedef map<int ,int >   mps;
#define pb push_back

/*int w=0;
int primefac(int q){
	int cnt=1;
	w=0;
	rep(i,2,(int)sqrt(q)+1){
		while(q%i==0){
			q=q/i;
			w++;
			if(i!=2) cnt=0;

		}
	}
	if(q>1){
		if(q!=2) cnt=0;
		w++;
	}
	return cnt;
}

*/

int32_t main()
{
	smackie;
	int n;
	cin>>n;
	int a[n];
	rep(i,0,n) cin>>a[i];
	sort(a,a+n);
	vector<int> v[n];

	rep(j,0,n){
		int p=a[j];
		rep(i,2,(int)sqrt(p)+1){
			if(p%i==0){
				while(p%i==0){
					p=p/i;
					if(i!=2 and i!=3){
						v[j].pb(i);
					}
				}
			}
		}
		if(p>=2){
		    if(p!=2 and p!=3){
						v[j].pb(p);
			}
		}
	}
	int k=1;
    rep(i,0,(int)v[0].size()){
		k=k*v[0][i];
	}

	int u=1,fl=0;
	for(int i=1;i<(int)n;i++){
		u=1;
		rep(j,0,(int)v[i].size()){
			u*=v[i][j];

		}
		if(u!=k){
			fl=1;
			break;
		}
	}
	if(fl==0) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;

}
//245423556 57532595
//7 34 34 68 34 34 68 34


 ////////////////////////////////////////BatTle rOweL ///////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define smackie ios_base::sync_with_stdio(0); cin.tie(0);
#define int long long int
#define endl '\n'
#define mset(a,k) memset(a,k,sizeof(a))
#define rep(i,l,h) for(int i=l;i<h;i++)
#define ds1(i,x) for(int  i=0;i<x.size();i++)
void in(int *a,int n){rep(i,0,n){cin>>a[i];}}
typedef vector<int>  vit;
typedef map<int ,int >   mps;
#define pb push_back

/*int w=0;
int primefac(int q){
	int cnt=1;
	w=0;
	rep(i,2,(int)sqrt(q)+1){
		while(q%i==0){
			q=q/i;
			w++;
			if(i!=2) cnt=0;

		}
	}
	if(q>1){
		if(q!=2) cnt=0;
		w++;
	}
	return cnt;
}

*/

int32_t main()
{
	smackie;
	int n;
	cin>>n;
	int a[n];
	rep(i,0,n) cin>>a[i];
	sort(a,a+n);
	vector<int> v[n];

	rep(j,0,n){
		int p=a[j];
		while (n % 2 == 0){
			p = p/2;
		}
		for(int i=3;i<(int)sqrt(p);i+=2){
			if(p%i==0){
				while(p%i==0){
					p=p/i;
					if(i!=2 and i!=3){
						v[j].pb(i);
					}
				}
			}
		}
		if(p>=2) v[j].pb(a[j]);
	}
	int k=1;
    rep(i,0,(int)v[0].size()){
		k=k*v[0][i];
	}
	int u=1,fl=0;
	for(int i=1;i<(int)n;i++){
		u=1;
		rep(j,0,(int)v[i].size()){
			u*=v[i][j];
		}
		if(u!=k){
			fl=1;
			break;
		}
	}
	if(fl==0) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;

}
//245423556 57532595
//7 34 34 68 34 34 68 34


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<ll> v(n);
    ll gcd = 0LL;
    for(ll i = 0; i < n; ++i){
        cin >> v[i];
        for(ll j = 2; j <= 3; ++j){
            while(v[i] % j == 0){
                v[i] /= j;
            }
        }
    }
    bool ok = 1;
    for(ll i = 0; i < n - 1; ++i){
        ok &= (v[i] == v[i + 1]);
    }
    cout << (ok ? "Yes" : "No") << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

int __lcm(int a, int b){
    return a*b/__gcd(a,b);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<int> v(n);
    int lcm = 1;
    for(int i = 0; i < n; ++i){
        cin >> v[i];
        lcm = __lcm(lcm, v[i]);
    }
    bool ok = 1;
    for(int i = 0; i < n; ++i){
        int x = lcm / v[i];
        ok &= (x % 2 || x % 3);
    }
    cerr << lcm << '\n';
    cout << (ok ? "Yes" : "No") << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

ll __lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<ll> v(n);
    ll lcm = 1LL;
    for(ll i = 0; i < n; ++i){
        cin >> v[i];
        lcm = __lcm(lcm, v[i]);
    }
    bool ok = 1;
    for(ll i = 0; i < n; ++i){
        ll x = lcm/v[i];
        if(x == 1){
            continue;
        }else{
            ll y = x;
            for(ll j = 2; j <= 3; ++j){
                while(x % j == 0){
                    x /= j;
                }
            }
            cerr << i << ' ' << x << '\n';
            ok &= (x == 1);
        }
    }
    cout << (ok ? "Yes" : "No") << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

ll __lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<ll> v(n);
    ll lcm = 1LL;
    for(ll i = 0; i < n; ++i){
        cin >> v[i];
        lcm = __lcm(lcm, v[i]);
    }
    bool ok = 1;
    for(ll i = 0; i < n; ++i){
        ll x = lcm/v[i];
        if(x == 1){
            continue;
        }else{
            for(ll j = 2; j <= 3; ++j){
                while(x % j == 0){
                    x /= j;
                }
            }
            ok &= (x == 1);
        }
    }
    cout << (ok ? "Yes" : "No") << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

ll __lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<ll> v(n);
    ll lcm = 1;
    for(ll i = 0; i < n; ++i){
        cin >> v[i];
        lcm = __lcm(lcm, v[i]);
    }
    bool ok = 1;
    for(int i = 0; i < n; ++i){
        ll x = lcm / v[i];
        ok &= (x % 2 || x % 3);
    }
    cerr << lcm << '\n';
    cout << (ok ? "Yes" : "No") << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

ll __lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<ll> v(n);
    ll lcm = 1LL;
    for(ll i = 0; i < n; ++i){
        cin >> v[i];
        lcm = __lcm(lcm, v[i]);
    }
    bool ok = 1;
    for(ll i = 0; i < n; ++i){
        ll x = lcm/v[i];
        if(x == 1){
            continue;
        }else{
            ll y = x;
            for(ll j = 2; j * j <= y && ok; ++j){
                ok &= (j > 3);
                while(x % j == 0){
                    x /= j;
                }
            }
            ok &= (x > 1);
        }
    }
    cout << (ok ? "Yes" : "No") << '\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
    return b==0 ? a : gcd(b, a%b);
}
int main()
{
    int n, i, g, is, temp;
    scanf("%d", &n);
    int a[n];
    for(i=0; i<n; i++)
        scanf("%d", &a[i]);
    set<int>s(a, a+n);
    vector<int>v;
    for(auto it=s.begin(); it!=s.end(); it++)
        v.push_back(*it);
    g=gcd(v[0], v[1]), is=1;
    for(i=2; i<v.size(); i++)
        g=gcd(g, v[i]);
    for(i=0; i<v.size(); i++){
        temp=v[i]/g;
        if(temp!=1 && temp%2!=0 && temp%3){
            is=0;
            break;
        }
    }
    is ? printf("Yes") : printf("No");
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
    return b==0 ? a : gcd(b, a%b);
}
int main()
{
    int n, i, g, is, temp;
    scanf("%d", &n);
    int a[n];
    for(i=0; i<n; i++)
        scanf("%d", &a[i]);
    set<int>s(a, a+n);
    vector<int>v;
    for(auto it=s.begin(); it!=s.end(); it++)
        v.push_back(*it);
    g=gcd(v[0], v[1]), is=1;
    for(i=2; i<v.size(); i++)
        g=gcd(g, v[i]);
    for(i=0; i<v.size(); i++){
        temp=v[i]/g;
        if(temp%2!=0 && temp%3){
            is=0;
            break;
        }
    }
    is ? printf("Yes") : printf("No");
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
    return b==0 ? a : gcd(b, a%b);
}
bool isPOWER2(int n)
{
    return n&&(!(n&(n-1)));
}
bool isPOWER3(int n)
{
    return 1162261467%n==0;
}
int main()
{
    int n, i, g, is, temp;
    scanf("%d", &n);
    int a[n];
    for(i=0; i<n; i++)
        scanf("%d", &a[i]);
    set<int>s(a, a+n);
    vector<int>v;
    for(auto it=s.begin(); it!=s.end(); it++)
        v.push_back(*it);
    g=gcd(v[0], v[1]), is=1;
    for(i=2; i<v.size(); i++)
        g=gcd(g, v[i]);
    for(i=0; i<v.size(); i++){
        temp=v[i]/g;
        if(!isPOWER2(temp)){
            if(!isPOWER3(temp)){
                if(temp!=1 && (temp%2!=0 || temp%3)){
                    is=0;
                    break;
                }
            }
        }
    }
    is ? printf("Yes") : printf("No");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d", &n);
    int a[n];
	for(int i=0; i<n; i++){
		scanf("%d", &a[i]);
		while(a[i]%2==0) a[i]/=2;
		while(a[i]%3==0) a[i]/=3;
	}
	for(int i=1; i<n; i++)
		if(a[0]!=a[i]){
			printf("No");
			return 0;
		}
	printf("Yes");
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ulli = unsigned long long int;
ulli gcd(ulli a, ulli b)
{
    return b==0 ? a : gcd(b, a%b);
}
bool isPOWER2(ulli n)
{
    return n&&(!(n&(n-1)));
}
bool isPOWER3(ulli n)
{
    return 1162261467%n==0;
}
int main()
{
    ulli n, i, g, is, temp;
    scanf("%lld", &n);
    ulli a[n];
    for(i=0; i<n; i++)
        scanf("%lld", &a[i]);
    set<ulli>s(a, a+n);
    vector<ulli>v;
    for(auto it=s.begin(); it!=s.end(); it++)
        v.push_back(*it);
    if(s.size()==1)
        printf("Yes");
    else{
        g=gcd(v[0], v[1]);
        is=1;
        for(i=2; i<v.size(); i++)
            g=gcd(g, v[i]);
        for(i=0; i<v.size(); i++){
            temp=v[i]/g;
            if(!isPOWER2(temp)){
                if(!isPOWER3(temp)){
                    if(temp%2!=0 || temp%3!=0){
                        is=0;
                        break;
                    }
                }
            }
        }
        is ? printf("Yes") : printf("No");
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define test long long int t; cin>>t; while(t-->0)
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define loop(n) for(long long int i=0;i<n;i++)
using namespace std;
int main()
{
    vector<vector<int>> v;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fIO
    ll n,c=0;
    cin>>n;
    ll a[n];
    loop(n) cin>>a[i];
    sort(a,a+n);
    ll f=1;
    for(int j=5;j<=sqrt(a[0]);j=j+2)
        {
            while(a[0]%j==0)
            {
                a[0]/=j;
                f=f*j;
            }
        }

    for(int i=1;i<n;i++)
    {
        if(a[i]%f==0)
        a[i]/=f;
    }

    loop(n)
    {
        while(a[i]%2==0)
        a[i]/=2;
    }
    loop(n)
    {
        while(a[i]%3==0)
        a[i]/=3;
    }
    loop(n)
    {
        if(a[i]%6==0)
        c++;
        else
         break;
    }
    loop(n)
    {
        if(a[i]==1)
        c++;
        else
         break;
    }
    if(c==n)
    cout<<"YES";
    else
    cout<<"NO";

    return 0;
}

//-------------------------------------FUNCTIONS-------------------------------------------------------


#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define test long long int t; cin>>t; while(t-->0)
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define loop(n) for(long long int i=0;i<n;i++)
using namespace std;
int main()
{
    vector<vector<int>> v;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fIO
    ll n,c=0;
    cin>>n;
    ll a[n];
    loop(n) cin>>a[i];
    sort(a,a+n);
    ll f=1;
    while(a[0]%2==0)
    a[0]/=2;
    while(a[0]%3==0)
    a[0]/=3;
    for(int j=5;j<=sqrt(a[0]);j=j+2)
        {
            while(a[0]%j==0)
            {
                a[0]/=j;
                f=f*j;
            }
        }
    if(a[0]>1)
    {
        f=f*a[0];
        a[0]=1;
    }
    for(int i=1;i<n;i++)
    {
        if(a[i]%f==0)
        a[i]=a[i]/f;
    }
    for(int i=1;i<n;i++)
    {
        while(a[i]%2==0)
        a[i]/=2;
    }
    for(int i=1;i<n;i++)
    {
        while(a[i]%3==0)
        a[i]/=3;
    }
    loop(n)
    {
        if(a[i]==1)
        c++;
        else
        break;
    }
    if(c==n)
    cout<<"YES";
    else
    cout<<"NO";

    return 0;
}

//-------------------------------------FUNCTIONS-------------------------------------------------------


#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define test long long int t; cin>>t; while(t-->0)
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define loop(n) for(long long int i=0;i<n;i++)
using namespace std;
int main()
{
    vector<vector<int>> v;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fIO
    ll n,c=0;
    cin>>n;
    ll a[n];
    loop(n) cin>>a[i];
    sort(a,a+n);
    ll f=1;
    while(a[0]%2==0)
    a[0]/=2;
    while(a[0]%3==0)
    a[0]/=3;
    for(int j=5;j<=sqrt(a[0]);j=j+2)
        {
            while(a[0]%j==0)
            {
                a[0]/=j;
                f=f*j;
            }
        }
    if(a[0]>1)
    {
        f=f*a[0];
        a[0]=1;
    }
    for(int i=1;i<n;i++)
    {
        while(a[i]%2==0)
        a[i]/=2;
    }
    for(int i=1;i<n;i++)
    {
        while(a[i]%3==0)
        a[i]/=3;
    }
    for(int i=1;i<n;i++)
    {
        a[i]=a[i]/f;
    }
    loop(n)
    {
        if(a[i]==1)
        c++;
        else
        break;
    }
    if(c==n)
    cout<<"YES";
    else
    cout<<"NO";

    return 0;
}

//-------------------------------------FUNCTIONS-------------------------------------------------------


#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define test long long int t; cin>>t; while(t-->0)
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define loop(n) for(long long int i=0;i<n;i++)
using namespace std;
int main()
{
    vector<vector<int>> v;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fIO
    ll n,c=0;
    cin>>n;
    ll a[n];
    loop(n) cin>>a[i];
    sort(a,a+n);
    ll f=1;
    for(int j=5;j<=sqrt(a[0]);j=j+2)
        {
            while(a[0]%j==0)
            {
                a[0]/=j;
                f=f*j;
            }
        }

    for(int i=1;i<n;i++)
    {
        if(a[i]%f==0)
        a[i]/=f;
    }

    loop(n)
    {
        while(a[i]%2==0)
        a[i]/=2;
    }
    loop(n)
    {
        while(a[i]%3==0)
        a[i]/=3;
    }
    loop(n)
    {
        if(a[i]>1)
        f=a[i];
    }
    loop(n)
    a[i]/=f;
    loop(n)
    {
        if(a[i]==1)
        c++;
        else
         break;
    }
    if(c==n)
    cout<<"YES";
    else
    cout<<"NO";

    return 0;
}

//-------------------------------------FUNCTIONS-------------------------------------------------------


#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define test long long int t; cin>>t; while(t-->0)
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define loop(n) for(long long int i=0;i<n;i++)
using namespace std;
int main()
{
    vector<vector<int>> v;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fIO
    ll n,c=1;
    cin>>n;
    ll a[n];
    loop(n) cin>>a[i];
    sort(a,a+n);
    ll f=1;
    while(a[0]%2==0)
    a[0]/=2;
    while(a[0]%3==0)
    a[0]/=3;
    for(int i=1;i<n;i++)
    {
        while(a[i]%2==0)
        a[i]/=2;
    }
    for(int i=1;i<n;i++)
    {
        while(a[i]%3==0)
        a[i]/=3;
    }
    ll p=a[0];
    for(int i=1;i<n;i++)
    {
        if(a[i]==p)
        c++;
    }
    if(c==n)
    cout<<"YES";
    else
    cout<<"NO";

    return 0;
}

//-------------------------------------FUNCTIONS-------------------------------------------------------


// Problem : A. Bear and Poker
// Contest : Codeforces - Codeforces Round #318 [RussianCodeCup Thanks-Round]
// (Div. 1) URL : https://codeforces.com/problemset/problem/573/A Memory Limit :
// 256 MB Time Limit : 2000 ms Powered by CP Editor
// (https://github.com/cpeditor/cpeditor)

/*
 * 竜
 * 平和な未来のために
 * あきらめないで
 */

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using db = double;
using str = string;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;

using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>;
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;

// pairs
#define ff first
#define ss second

// vectors
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define tests\
int \
  t;           \
  cin >> t;    \
  while (t--)
// loops
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i, 0, a)
#define trav(a, x) for (auto& a : x)

// constants
const int MOD = 1e9 + 7;  // 998244343;
const int MX = 1e6 + 4;
const ll INF = 1e18;  // not too close to LLONG_MAX
const ld PI = acos((ld)-1);
const int xd[4] = {1, 0, -1, 0},
          yd[4] = {0, 1, 0, -1};  // for every grid problem!!
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

#define tcT template <class T
// ^ lol this makes everything look weird but I'll try it
tcT > using V = vector<T>;
tcT, size_t SZ > using AR = array<T, SZ>;

// helper funcs
tcT > T gcd(T& a, T& b) { return __gcd(a, b); }
tcT > T lcm(T& a, T& b) { return (a * b) / gcd(a, b); }
constexpr int pct(int x) { return __builtin_popcount(x); }  // # of bits set
constexpr int bits(int x) {
  return 31 - __builtin_clz(x);
}  // floor(log2(x)), change if 64
ll cdiv(ll a, ll b) {
  return a / b + ((a ^ b) > 0 && a % b);
}  // divide a by b rounded up
ll fdiv(ll a, ll b) {
  return a / b - ((a ^ b) < 0 && a % b);
}  // divide a by b rounded down
ll half(ll x) { return fdiv(x, 2); }

tcT > bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}  // set a = min(a,b)
tcT > bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

#define tcTU tcT, class U

tcTU > T fstTrue(T lo, T hi, U f) {
  // note: if (lo+hi)/2 is used instead of half(lo+hi)
  // then this will loop infinitely when lo=hi
  hi++;
  assert(lo <= hi);  // assuming f is increasing
  while (lo < hi) {  // find first index such that f is true
    T mid = half(lo + hi);
    f(mid) ? hi = mid : lo = mid + 1;
  }
  return lo;
}

tcTU > T lstTrue(T lo, T hi, U f) {
  lo--;
  assert(lo <= hi);  // assuming f is decreasing
  while (lo < hi) {  // find first index such that f is true
    T mid = half(lo + hi + 1);
    f(mid) ? lo = mid : hi = mid - 1;
  }
  return lo;
}

tcT > void remDup(vector<T>& v) {  // sort and remove duplicates
  sort(all(v));
  v.erase(unique(all(v)), end(v));
}

tcTU > void erase(T& t,
                  const U& u) {  // don't try to erase
  auto it = t.find(u);
  assert(it != end(t));
  t.erase(u);
}  // element that doesn't exist from (multi)set

// FILE I/O
void setIn(const str& s) { freopen(s.c_str(), "r", stdin); }

void setOut(const str& s) { freopen(s.c_str(), "w", stdout); }

void unsyncIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}

void setIO(str s = "") {
  unsyncIO();
  // cin.exceptions(cin.failbit);
  // throws exception when do smth illegal
  // ex. try to read letter into int
  if (sz(s)) {
    setIn(s + ".in"), setOut(s + ".out");
  }
}

void solve() {
  // がんばって
  int n, m;
  cin >> n;
  vi a(n);
  F0R(i, n) {
    cin >> a[i];
    if (i == 0)
      m = a[i];
    else
      m = lcm(m, a[i]);
  }
  bool sol = true;
  F0R(i, n) {
    int val = m / a[i];
    while (val % 2 == 0 || val % 3 == 0) {
      if (val % 2 == 0)
        val /= 2;
      else
        val /= 3;
    }
    if (val != 1) {
      sol = false;
      break;
    }
  }
  cout << (sol ? "Yes" : "No");
}

int main() {
  setIO();
  //    tests
  solve();
  return 0;
}


// Problem : A. Bear and Poker
// Contest : Codeforces - Codeforces Round #318 [RussianCodeCup Thanks-Round]
// (Div. 1) URL : https://codeforces.com/problemset/problem/573/A Memory Limit :
// 256 MB Time Limit : 2000 ms Powered by CP Editor
// (https://github.com/cpeditor/cpeditor)

/*
 * 竜
 * 平和な未来のために
 * あきらめないで
 */

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using db = double;
using str = string;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;

using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>;
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;

// pairs
#define ff first
#define ss second

// vectors
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define tests\
int \
  t;           \
  cin >> t;    \
  while (t--)
// loops
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i, 0, a)
#define trav(a, x) for (auto& a : x)

// constants
const int MOD = 1e9 + 7;  // 998244343;
const int MX = 1e6 + 4;
const ll INF = 1e18;  // not too close to LLONG_MAX
const ld PI = acos((ld)-1);
const int xd[4] = {1, 0, -1, 0},
          yd[4] = {0, 1, 0, -1};  // for every grid problem!!
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

#define tcT template <class T
// ^ lol this makes everything look weird but I'll try it
tcT > using V = vector<T>;
tcT, size_t SZ > using AR = array<T, SZ>;

// helper funcs
tcT > T gcd(T& a, T& b) { return __gcd(a, b); }
tcT > T lcm(T& a, T& b) { return (a * b) / gcd(a, b); }
constexpr int pct(int x) { return __builtin_popcount(x); }  // # of bits set
constexpr int bits(int x) {
  return 31 - __builtin_clz(x);
}  // floor(log2(x)), change if 64
ll cdiv(ll a, ll b) {
  return a / b + ((a ^ b) > 0 && a % b);
}  // divide a by b rounded up
ll fdiv(ll a, ll b) {
  return a / b - ((a ^ b) < 0 && a % b);
}  // divide a by b rounded down
ll half(ll x) { return fdiv(x, 2); }

tcT > bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}  // set a = min(a,b)
tcT > bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

#define tcTU tcT, class U

tcTU > T fstTrue(T lo, T hi, U f) {
  // note: if (lo+hi)/2 is used instead of half(lo+hi)
  // then this will loop infinitely when lo=hi
  hi++;
  assert(lo <= hi);  // assuming f is increasing
  while (lo < hi) {  // find first index such that f is true
    T mid = half(lo + hi);
    f(mid) ? hi = mid : lo = mid + 1;
  }
  return lo;
}

tcTU > T lstTrue(T lo, T hi, U f) {
  lo--;
  assert(lo <= hi);  // assuming f is decreasing
  while (lo < hi) {  // find first index such that f is true
    T mid = half(lo + hi + 1);
    f(mid) ? lo = mid : hi = mid - 1;
  }
  return lo;
}

tcT > void remDup(vector<T>& v) {  // sort and remove duplicates
  sort(all(v));
  v.erase(unique(all(v)), end(v));
}

tcTU > void erase(T& t,
                  const U& u) {  // don't try to erase
  auto it = t.find(u);
  assert(it != end(t));
  t.erase(u);
}  // element that doesn't exist from (multi)set

// FILE I/O
void setIn(const str& s) { freopen(s.c_str(), "r", stdin); }

void setOut(const str& s) { freopen(s.c_str(), "w", stdout); }

void unsyncIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}

void setIO(str s = "") {
  unsyncIO();
  // cin.exceptions(cin.failbit);
  // throws exception when do smth illegal
  // ex. try to read letter into int
  if (sz(s)) {
    setIn(s + ".in"), setOut(s + ".out");
  }
}

void solve() {
  // がんばって
  unsigned long long n, m;
  cin >> n;
  vl a(n);
  F0R(i, n) {
    cin >> a[i];
    if (i == 0)
      m = a[i];
    else
      m = lcm(m, a[i]);
  }
  bool sol = true;
  F0R(i, n) {
    int val = m / a[i];
    while (val % 2 == 0 || val % 3 == 0) {
      if (val % 2 == 0)
        val /= 2;
      else
        val /= 3;
    }
    if (val != 1) {
      sol = false;
      break;
    }
  }
  cout << (sol ? "Yes" : "No");
}

int main() {
  setIO();
  //    tests
  solve();
  return 0;
}


// Problem : A. Bear and Poker
// Contest : Codeforces - Codeforces Round #318 [RussianCodeCup Thanks-Round]
// (Div. 1) URL : https://codeforces.com/problemset/problem/573/A Memory Limit :
// 256 MB Time Limit : 2000 ms Powered by CP Editor
// (https://github.com/cpeditor/cpeditor)

/*
 * 竜
 * 平和な未来のために
 * あきらめないで
 */

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using db = double;
using str = string;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;

using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>;
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;

// pairs
#define ff first
#define ss second

// vectors
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define tests\
int \
  t;           \
  cin >> t;    \
  while (t--)
// loops
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i, 0, a)
#define trav(a, x) for (auto& a : x)

// constants
const int MOD = 1e9 + 7;  // 998244343;
const int MX = 1e6 + 4;
const ll INF = 1e18;  // not too close to LLONG_MAX
const ld PI = acos((ld)-1);
const int xd[4] = {1, 0, -1, 0},
          yd[4] = {0, 1, 0, -1};  // for every grid problem!!
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

#define tcT template <class T
// ^ lol this makes everything look weird but I'll try it
tcT > using V = vector<T>;
tcT, size_t SZ > using AR = array<T, SZ>;

// helper funcs
tcT > T gcd(T& a, T& b) { return __gcd(a, b); }
tcT > T lcm(T& a, T& b) { return (a * b) / gcd(a, b); }
constexpr int pct(int x) { return __builtin_popcount(x); }  // # of bits set
constexpr int bits(int x) {
  return 31 - __builtin_clz(x);
}  // floor(log2(x)), change if 64
ll cdiv(ll a, ll b) {
  return a / b + ((a ^ b) > 0 && a % b);
}  // divide a by b rounded up
ll fdiv(ll a, ll b) {
  return a / b - ((a ^ b) < 0 && a % b);
}  // divide a by b rounded down
ll half(ll x) { return fdiv(x, 2); }

tcT > bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}  // set a = min(a,b)
tcT > bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

#define tcTU tcT, class U

tcTU > T fstTrue(T lo, T hi, U f) {
  // note: if (lo+hi)/2 is used instead of half(lo+hi)
  // then this will loop infinitely when lo=hi
  hi++;
  assert(lo <= hi);  // assuming f is increasing
  while (lo < hi) {  // find first index such that f is true
    T mid = half(lo + hi);
    f(mid) ? hi = mid : lo = mid + 1;
  }
  return lo;
}

tcTU > T lstTrue(T lo, T hi, U f) {
  lo--;
  assert(lo <= hi);  // assuming f is decreasing
  while (lo < hi) {  // find first index such that f is true
    T mid = half(lo + hi + 1);
    f(mid) ? lo = mid : hi = mid - 1;
  }
  return lo;
}

tcT > void remDup(vector<T>& v) {  // sort and remove duplicates
  sort(all(v));
  v.erase(unique(all(v)), end(v));
}

tcTU > void erase(T& t,
                  const U& u) {  // don't try to erase
  auto it = t.find(u);
  assert(it != end(t));
  t.erase(u);
}  // element that doesn't exist from (multi)set

// FILE I/O
void setIn(const str& s) { freopen(s.c_str(), "r", stdin); }

void setOut(const str& s) { freopen(s.c_str(), "w", stdout); }

void unsyncIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}

void setIO(str s = "") {
  unsyncIO();
  // cin.exceptions(cin.failbit);
  // throws exception when do smth illegal
  // ex. try to read letter into int
  if (sz(s)) {
    setIn(s + ".in"), setOut(s + ".out");
  }
}

void solve() {
  // がんばって
  ll n, m;
  cin >> n;
  vl a(n);
  F0R(i, n) {
    cin >> a[i];
    if (i == 0)
      m = a[i];
    else
      m = lcm(m, a[i]);
  }
  bool sol = true;
  F0R(i, n) {
    int val = m / a[i];
    while (val % 2 == 0 || val % 3 == 0) {
      if (val % 2 == 0)
        val /= 2;
      else
        val /= 3;
    }
    if (val != 1) {
      sol = false;
      break;
    }
  }
  cout << (sol ? "Yes" : "No");
}

int main() {
  setIO();
  //    tests
  solve();
  return 0;
}