Superconducting and Spin-Glass Interaction in Coupled Layered Structure