Is there something well-known about which ring can be a cohomology ring of a manifold? More concretely, I would be interested in the following question: does there exists an $m$, s.t. for each $r,s\in\mathbb{N}$ and $\beta\_{i,j}^k\in\mathbb{Z}$, there exists a connected compact $m$-manifold $M$ s.t. $H^2(M)\simeq \mathbb{Z}^r$, $H^4(M)\simeq \mathbb{Z}^{s}$ and $x\_i\smile x\_j=\sum \beta\_{i,j}^k y\_k$ for the cohomology generators? I would be grateful for some reference..



What can be the cohomology ring of a manifold?
You probably meant $\beta\_{ij}^k=\beta\_{ji}^k$ (the cup-product is commutative). With that condition, there is always a simply-connected compact $7$-manifold $M$ whose only non-trivial cohomology groups are $H^0(M)\cong\mathbb{Z}$, $H^2(M)\cong\mathbb{Z}^r$, and $H^4(M)\cong\mathbb{Z}^s$, and such that the cup-product is as you indicate. 


The manifold $M$ can be constructed from a CW-complex $X$ defined as the mapping cone of a certain map $\varphi\colon\vee\_s S^3\rightarrow\vee\_rS^2$. There is a subpolyhedron $K\subset\mathbb{R}^7$ of the same (even simple) homotopy type of $X$, see <http://math.berkeley.edu/~stall/embkloz.pdf>. Take $M$ to be the closure of a nice regular neighbourhood of $K\subset\mathbb{R}^7$. This $M$ is a compact simply-connected $7$-manifold (with boundary). The manifold $M$ is (simply) homotopy equivalent to $X$.


Let me now indicate how to define $\varphi$ to get the desired cohomology ring, see Baues' book on 4-dimensional complexes.


Recall that $\pi\_3(\vee\_rS^2)\cong\Gamma(\mathbb{Z}^r)$. Here $\Gamma$ is Whitehead's functor, defined for any abelian group $A$ by the existence of a universal *quadratic* map $\gamma\colon A\rightarrow\Gamma(A)$ (not a homomorphism), i.e. a map such that $\gamma(a)=\gamma(-a)$ and the *cross effect* map $A\times A\rightarrow \Gamma(A)\colon (a,b)\mapsto (a|b)=\gamma(a+b)-\gamma(a)-\gamma(b)$ is bilinear. The isomorphism $\pi\_3(\vee\_rS^2)\cong\Gamma(\mathbb{Z}^r)$ is defined by the map $\mathbb{Z}^r\cong \pi\_2(\vee\_rS^2)\rightarrow \pi\_3(\vee\_rS^2)\colon f\mapsto f\eta$ given by pre-composition with the Hopf map $\eta\colon S^3\rightarrow S^2$, which is universal with those properties. The group $\Gamma(\mathbb{Z}^r)$ is free abelian of rank $\binom{r+1}{2}$. If $\{e\_1,\dots,e\_r\}\subset \mathbb{Z}^r$ is a basis, then $\{\gamma(e\_1),\dots,\gamma(e\_r)\}\cup\{(e\_i|e\_j) \,;\, 1\leq i < j \leq r\}\subset \Gamma(\mathbb{Z}^r)$ is a basis.


There is a natural homomorphism $\tau\colon \Gamma(A)\rightarrow A\otimes A$ defined by the quadratic map $A\rightarrow A\otimes A\colon a\mapsto a\otimes a$. If $A=\mathbb{Z}^r$ then $\tau(\gamma(e\_i))=e\_i\otimes e\_i$ and $\tau(e\_i|e\_j)=e\_i\otimes e\_j+e\_j\otimes e\_i$. 


A homotopy class $\varphi\colon\vee\_s S^3\rightarrow\vee\_rS^2$ is essentially the same as a homomorphism $f=\pi\_3(\varphi)\colon \mathbb{Z}^s\rightarrow \Gamma(\mathbb{Z}^r)$. The cohomology of the mapping cone $X$ is obviously $H^0(X)\cong\mathbb{Z}$, $H^2(X)\cong\mathbb{Z}^r$, $H^4(X)\cong\mathbb{Z}^s$, and zero otherwise. The cup-product $H^2(X)\otimes H^2(X)\rightarrow H^4(X)$ turns out to be the $\mathbb{Z}$-linear dual of $\tau f\colon \mathbb{Z}^s\rightarrow \Gamma(\mathbb{Z}^r)\rightarrow \mathbb{Z}^r\otimes \mathbb{Z}^r$. Hence, if $\{e\_1,\dots,e\_r\}\subset \mathbb{Z}^r$ and $\{\bar e\_1,\dots, \bar e\_s\}\subset\mathbb{Z}^s$ are the canonical bases, given by the inclusions of the factors of the wedges, it is enough to define $f$, and hence $\varphi$, as $f(\bar e\_k)=\sum\_{i=1}^r \beta\_{ii}^k\gamma(e\_i)+\sum\_{1\leq i<k \leq r}\beta\_{ij}^k(e\_i|e\_j)$.


