Uncovering hidden network architecture from spiking activities using an exact statistical input-output relation of neurons