Ancient genomes help trace demographic shifts, shared ancestry of modern communities