//http://ja.doukaku.org/
//http://ja.doukaku.org/99/投稿用
using System;
using System.Collections.Generic;

namespace どう書く_org文字列の八方向検索 {
	class Program {
		static string search;
		static List<string> list;
		static void Main(string[] args) {
			string sample = "リオウウリウ\nウオリウオリ\nオリリオリウ\nリリオオウオ";
			search = "ウオリ";
			char[] sp = new char[] { '\n' };
			int width = sample.Split(sp)[0].Length;
			int height = sample.Split(sp).Length;
			list = new List<string>(sample.Split(sp));
			for(int y = 0; y < list.Count; y++) { //縦ループ
				for(int x = 0; x < list[y].Length; x++) { //横ループ
					for(int dx = -1; dx <= 1; dx++) { //左右方向ループ
						for(int dy = -1; dy <= 1; dy++) { //上下方向ループ　-1は上、左　1は下、右を表す
							try {
								string strb = "";
								for(int i = 0; i < search.Length; i++) { //iは移動量
									strb += list[y + i * dy][x + i * dx]; //移動方向をdy,dxで乗算することで反転
								}
								if(search == strb) {
									string directionStr = "";
									if(dx < 0) {
										directionStr += "左";
									} else if(dx > 0) {
										directionStr += "右";
									}
									if(dy < 0) {
										directionStr += "上";
									} else if(dy > 0) {
										directionStr += "下";
									}
									Console.WriteLine("(" + x + "," + y + ")" + "," + directionStr);
								}
							} catch(ArgumentOutOfRangeException) { } catch(IndexOutOfRangeException) { }
						}
					}
				}
			}
			Console.ReadLine();
		}
	}
}