When it sees a familiar bird building a nest, it decides when to lay its own egg.