Completed: get nearest group ancestor key for each note