Interaction between rare earth ion layer and CuO layers in RBa2Cu3Oy(R=magnetic rare earth ions)