using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
static class Program
{
    static void Main()
    {
            var p = new Problem();
            while (true)
            {
                var b=   p.A();
                if (!b)
                    break;
            }
    }
}

public class Problem
{
    public bool A()
    {
        var input = IO.IARead();
        var h = input[0];
        var w = input[1];

        if (w == 0 || h == 0)
            return false;

        int x = 0;
        int y = 0;
        var loop = false;
        List<List<char>> array = new List<List<char>>();
        h.For((t) =>
            {
                var list = new List<char>();
                var s = Console.ReadLine();
                w.For(i =>
                {
                    list.Add(s[i]);
                });
                array.Add(list);
            });

        while (!loop)
        {
            var c = array[y][x];
            if (c == '.')
                break;
            array[y][x] = 'x';
            switch (c)
            {
                case '^': y--;
                    break;
                case 'v': y++;
                    break;
                case '>': x++;
                    break;
                case '<': x--;
                    break;
                case 'x': loop = true;
                    break;
            }

            
        }

        if (loop)
            Console.WriteLine("LOOP");
        else
            Console.WriteLine("{0} {1}",x,y);

        return true;

        

    }

}


static public class IO
{
    static public void SetIn()
    {
        var sr = new System.IO.StreamReader("sample.txt");
        Console.SetIn(sr);
    }

    static public int IRead()
    {
        return int.Parse(Console.ReadLine());
    }
    static public int[] IARead(char c = ' ')
    {
        return Console.ReadLine().Split(c).Select(x => int.Parse(x)).ToArray();
    }
    static public long LRead()
    {
        return long.Parse(Console.ReadLine());
    }
    static public long[] LARead(char c = ' ')
    {
        return Console.ReadLine().Split(c).Select(x => long.Parse(x)).ToArray();
    }
    static public double DRead()
    {
        return double.Parse(Console.ReadLine());
    }
    static public double[] DARead(char c = ' ')
    {
        return Console.ReadLine().Split(c).Select(x => double.Parse(x)).ToArray();
    }
}
static public class Rep
{
    static public void For(this int range, Action<int> action, int start = 0)
    {
        for (int i = start; i < range + start; i++)
        {
            action(i);
        }
    }

    static public void For(this int range, Func<int, bool> func, int start = 0)
    {
        for (int i = start; i < range + start; i++)
        {
            var b = func(i);
            if (!b)
                break;
        }
    }
    static public void ForEach<T>(this IEnumerable<T> source, Action<T> action)
    {
        foreach (var x in source)
        {
            action(x);
        }
    }
    static public void ForEach<T>(this IEnumerable<T> source, Func<T, bool> func)
    {
        foreach (var x in source)
        {
            var b = func(x);
            if (!b)
                break;
        }
    }
}
//*/


Measured memory_bytes: 6200