# Header {{{
require 'forwardable'

def assert(p)
  raise 'Assertion Failed' unless p
end

class MyIO
  def initialize
    @source = STDIN
  end

  # @param filename [String]
  def set_source(filename)
    @source = File.open(filename, 'r')
  end

  def intl
    splitl.map(&:to_i)
  end

  def splitl
    @source.gets.chomp.split(' ')
  end

  def gets
    @source.gets.chomp
  end
end

class Field
  extend Forwardable
  def_delegators :@field, :[]

  DIRECTIONS = [:up, :right, :down, :left]

  attr_accessor :h, :w

  class DyDx
    attr_accessor :y, :x

    DYDX_BY_DIRECTIONS = { up: [-1, 0], right: [0, 1], down: [1, 0], left: [0, -1] }

    class << self
      DIRECTIONS.each do |dir|
        define_method(dir.to_s) { self.new(dir, *DYDX_BY_DIRECTIONS[dir]) }
      end
    end

    def initialize(id, y, x)
      @id, @y, @x = id, y, x
    end

    def index
      DIRECTIONS.find_index(@id)
    end
  end

  class << self
    def dydx4
      [DyDx.up, DyDx.right, DyDx.down, DyDx.left]
    end
  end

  def initialize(field)
    assert(field.is_a?(Array))
    assert(field[0].is_a?(Array))
    @field = field
    @h, @w = field.size, field[0].size
  end

  def inside?(y, x)
    0 <= y && y < @h && 0 <= x && x < @w
  end

  def to_s
    str = ''
    @field.each do |row|
      row.each do |cell|
        str += cell.to_s
      end
      str += "\n"
    end
    str
  end
end

io = MyIO.new
# }}}

io.set_source('inputs/0.txt')

def dir2i(d)
  { N: 0, E: 1, S: 2, W: 3 }[d.to_sym]
end

def i2dir(i)
  [ 'N', 'E', 'S', 'W' ][i]
end

class Robot
  attr_accessor :y, :x, :dir
  def initialize(y, x, dir)
    @y, @x, @dir = y, x, dir
  end

  def move(dydx)
    self.class.new(@y + dydx.y, @x + dydx.x, dydx.index)
  end
end

while true
  h, w, l = io.intl
  break if h == 0
  robot = nil
  _field = []
  h.times do |i|
    _field << io.gets.split('')
    w.times do |j|
      unless ['.', '#'].include?(_field[i][j])
        robot = Robot.new(i, j, dir2i(_field[i][j]))
        _field[i][j] = '.'
      end
    end
  end
  field = Field.new(_field)

  @cost = Array.new(h) { Array.new(w) { Array.new(4, nil) } }
  def cost_of(rob)
    @cost[rob.y][rob.x][rob.dir]
  end
  def set_cost(rob, val)
    @cost[rob.y][rob.x][rob.dir] = val
  end

  looped = false
  dist = 0
  while true
    set_cost(robot, dist)
    if dist == l
      break
    end

    moved = false
    4.times do |d|
      di = (robot.dir + d) % 4
      dydx = Field.dydx4[di]
      nr = robot.move(dydx)
      if field.inside?(nr.y, nr.x) && field[nr.y][nr.x] == '.'
        if !looped && !cost_of(nr).nil?
          looped = true
          rest = l - dist
          loop_len = cost_of(robot) - cost_of(nr) + 1
          rest %= loop_len
          l = rest
          dist = 0
        end

        robot = nr
        moved = true
        dist += 1
        break
      end
    end
    assert(moved)
  end

  puts [robot.y + 1, robot.x + 1, i2dir(robot.dir)].join(' ')
end
# vim: foldmethod=marker