Relation between highT c superconductivity and structure: A study of Ba3+x Cu6O14+δ and YBa2Cu3O7−δ systems