For the first one you search something like this:
$users = User::factory()->count(5)->has(List::factory()->count(5))->has(Group::factory())->has(List::factory())->create();
foreach($users as $user) {
$others = $users->filter(function($item) use($user) { return $user->id != $item->id});
$rand_users = $others->random(rand(1,$others->count()));
$user->group->users()->sync($rand_users->pluck('id'));
$rand_users = $others->random(rand(1,$others->count()));
$user->list->users()->sync($rand_users->pluck('id'));
}
The code is not tested but based on the factory docs and my own DatabaseSeeder for some demo apps and should help you get a headstart.