For a positive integer n we introduce quadratic Lie algebras tr_n qtr_n and
discrete groups Tr_n, QTr_n naturally associated with the classical and quantum Yang-Baxter
equation, respectively. We prove that the universal enveloping algebras of the Lie algebras
tr_n, qtr_n are Koszul, and find their Hilbert series. We also compute the cohomology rings
of these Lie algebras (which by Koszulity are the quadratic duals of the enveloping
algebras). We construct cell complexes which are classifying spaces of the groups Tr_n and
QTr_n, and show that the boundary maps in them are zero, which allows us to compute the
integral cohomology of these groups. We show that the Lie algebras tr_n, qtr_n map onto the
associated graded algebras of the Malcev Lie algebras of the groups Tr_n, QTr_n,
respectively. We conjecture that this map is actually an isomorphism (this is now a theorem
due to P. Lee). At the same time, we show that the groups Tr_n and QTr_n are not formal for
n>3.