using System.Collections.Concurrent;
using System.Collections.Generic;
class Genome : Queue<char>, IEquatable<Genome>
public bool Equals(Genome other) => this.SequenceEqual(other);
public static void Main()
ConcurrentDictionary<int, Genome> dictionary = new();
CancellationTokenSource cts = new(TimeSpan.FromSeconds(1));
Thread[] threads = Enumerable.Range(1, 2).Select(i => new Thread(() =>
while (!cts.IsCancellationRequested)
Genome genome = dictionary.AddOrUpdate(1, _ => new(), (_, _) => new());
lock (genome) genome.Enqueue('A');
Array.ForEach(threads, t => t.Start());
Array.ForEach(threads, t => t.Join());