#include <stdio.h>

int main(void)
{
	int w, h, i, j;
	char dummy;
	char a[100][100] = {0};

	scanf("%d %d", &w, &h);

	while ((w != 0) && (h != 0))
	{
		scanf("%c", &dummy);
		for (j = 0; j < h; j++)
			gets(a[j]);

		i = 0;
		j = 0;
		while (1)
		{
			if (a[j][i] == 'L')
			{
				printf("LOOP\n");
				break;
			}
			a[j][i] = 'L';
			
			if (a[j][i] == '>')
				i++;
			else if (a[j][i] == '<')
				i--;
			else if (a[j][i] == '^')
				j--;
			else if (a[j][i] == 'v')
				j++;
			else if (a[j][i] == '.')
			{
				printf("%d %d\n", i, j);
				break;
			}
		}

		scanf("%d %d", &w, &h);
	}

	return 0;
}