Gluing together two Yang-Mills algebras