inputs = (gets).split(" ")
I = inputs[0].to_i
J = inputs[1].to_i
Q = inputs[2].to_i

road_i = []
(gets).chars do |c|
  case c
    when 'W'
      road_i << false
    when 'E'
      road_i << true
    else
      break
  end
end

road_j = []
(gets).chars do |c|
  case c
    when 'N'
      road_j << false
    when 'S'
      road_j << true
    else
      break
  end
end

class Dijkstra
  def initialize(ii, jj)
      @iwe = ii.dup
      @jns = jj.dup
      @blist = []
      @safe = 0
      #p @iwe
      #p @jns
  end

  def blist_add(p, expand=false)
      i,j,d = p
      @blist << p
      if expand then
          @blist << [i-1, j] if (i > 0 && @jns[j])
          @blist << [i+1, j] if (i < I-1 && !@jns[j])
          @blist << [i, j-1] if (j > 0 && @iwe[i])
          @blist << [i, j+1] if (j < J-1 && !@iwe[i])
      end
  end
  def blist_check(ps)
      rps = []
      ps.each do |p|
          p2 = p[0..1]
          if not @blist.include?(p2) then
              rps << p
              @blist << p2
          end
      end
      #p rps
      #@blist = @blist + rps if not rps.length == 0
      return rps
  end
  def blist_rm(p)
      @blist.reject!{ |i,j| i==p[0] && j==p[1] }
  end
  def blist_clear()
      @blist = []
  end

  def next_get(p)
      rp = []
      i = p[0]
      j = p[1]
      d = p[2] + 1
      rp << [i-1, j, d] if (i > 0 && !@jns[j])
      rp << [i+1, j, d] if (i < I-1 && @jns[j])
      rp << [i, j-1, d] if (j > 0 && !@iwe[i])
      rp << [i, j+1, d] if (j < J-1 && @iwe[i])
      #puts "(#{i}, #{j}, #{d-1})"
      #p rp
      return blist_check(rp)
  end

  def search(p1, p2)
      blist_clear()
      #p p1
      #p p2
      goal_i, goal_j = p2
      pos = []
      pos << [p1[0], p1[1], 0] # pos/poの２つめの要素は距離を示す
      isGoal = false
      #p pos
      blist_add(p1)
      #blist_add(p2)
      blist_rm(p2)
      #while @safe < 12
      while true
          #@safe = @safe + 1
          buf = []
          if pos.length == 0 then
              pos << [0, 0, -1]
              #puts "end"
              break
          end
          pos.map! do |po|
              nps = next_get(po)
              #if nps.length == 0 then
              #    po[0] = -1
              #    next
              #end
              #p nps
              if not ( arrived = nps.find{ |i,j,d| (i==goal_i && j==goal_j) } ).nil? then
                  isGoal = true
                  #puts ">> Goal! <<"
                  buf << arrived
                  break
              end
              buf = buf + nps
          end
          pos = buf.dup
          #puts "---"
          #p pos
          #p @blist
          break if isGoal
      end
      #p pos
      return ( pos.map{ |po| po[2]} ).min
  end
end

dik = Dijkstra.new(road_i, road_j)
answers = []
Q.times do
    ins = (gets).split(" ").map{|g| g.to_i - 1}
    dist = dik.search([ins[0], ins[1]], [ins[2], ins[3]])
    answers << dist
end

answers.each {|ans| puts ans}