### constant

TYPE_D = 0
TYPE_F = 1

INDEX_FILE = 'index.html'

### subroutines

def search_path(root, path)
  segs = path.split('/')
  segs.shift
  segs << '' if path[-1] == '/'
  #p segs
  
  cdir = root
  nmpath = [root]

  for seg in segs
    return nil if cdir[1] == TYPE_F

    if seg == '.'
      next
    elsif seg == '..'
      nmpath.pop
      return nil if nmpath.empty?
      cdir = nmpath.last
    elsif seg == ''
      idx = cdir[2].index{|d| d[0] == INDEX_FILE && d[1] == TYPE_F}
      return nil if idx.nil?
      cdir = cdir[2][idx]
      nmpath << cdir
    else
      idx = cdir[2].index{|d| d[0] == seg}
      return nil if idx.nil?
      cdir = cdir[2][idx]
      nmpath << cdir
    end
  end

  if cdir[1] == TYPE_D
    idx = cdir[2].index{|d| d[0] == INDEX_FILE && d[1] == TYPE_F}
    return nil if idx.nil?
    nmpath << cdir[2][idx]
  end

  return nil if nmpath.last[1] == TYPE_D
  
  nmpath.map{|nmseg| nmseg[0]}
end

### main

loop do
  n, m = gets.split.map(&:to_i)
  break if (n | m) == 0

  root = ["", TYPE_D, []]
  n.times do
    psegs = gets.strip.split('/')
    psegs.shift
    #p psegs

    file = psegs.pop
    cdir = root

    for pseg in psegs
      idx = cdir[2].index{|d| d[0] == pseg && d[1] == TYPE_D}
      if idx.nil?
        idx = cdir[2].length
        cdir[2] << [pseg, TYPE_D, []]
      end
      cdir = cdir[2][idx]
    end
    cdir[2] << [file, TYPE_F]
  end
  #p root

  m.times do
    path0 = gets.strip
    path1 = gets.strip
    #p [path0, path1]
    
    nmpath0 = search_path(root, path0)
    nmpath1 = search_path(root, path1)
    #p [nmpath0, nmpath1]
    
    if nmpath0.nil? || nmpath1.nil?
      puts 'not found'
    else
      puts (nmpath0 == nmpath1) ? 'yes' : 'no'
    end
  end
end