Converse of the Order-Preserving Property of Homomorphism/Isomorphism I was aware that homomorphism/isomorphism is order-preserving (i.e. $\phi: G \to H$ is an isomorphism $\implies$ ord(g) = ord($\phi(g))$, $\forall g \in G$), but I was not sure whether the converse holds (for finite groups):

Let G, H be groups.
If ord(G) = ord(H), and $\forall$ g $\in$ G, $\exists$ (or $\exists!$) h $\in$ H s.t. ord(g) = ord(h).
(And vise versa, $\forall$ h $\in$ H, $\exists$ (or $\exists!$) g $\in$ G s.t. ord(g) = ord(h).)
Does this imply that G $\cong$ H please?
If not, what will be a counterexample please?

More rigorously, suppose $f: H \to G$ is a bijection s.t. ord(f(x)) = ord(x), $\forall$ x $\in$ G.
Does this imply that f an isomorphism please?

I think it doesn't hold for infinite groups, but for finite groups, I was struggling to either find a direct proof or a counterexample.
I have tried constructing counterexamples by taking the direct product of some non-abelian & non-cyclic groups of lower order, but didn't quite work out.
An example which I considered is $Z_3 \times Z_3 \times Z_3$ and G = <x, y, z> modulo $x^3=y^3=z^3$; yz = zyx; xy = yx; xz= zx
Many thanks in advance!
 A: This is quite false even for finite groups, see this MO question. A nice counterexample is given by the Heisenberg group $H_3(\mathbb{F}_3)$, which is a group of order $27$ where all non-identity elements have order $3$, so has the same order profile as $C_3^3$ (which is stronger than your first condition; we remember multiplicities, or equivalently there is a bijection which preserves orders, which is your second condition), but the two are non-isomorphic because the Heisenberg group is non-abelian. The smallest counterexamples have order $16$, and a general counting argument shows that the number of $p$-groups grows much too fast for any statement like this to be true.
A: A simple counterexample is $\mathbb{Z}$ and $\mathbb{Z}\oplus\mathbb{Z}$. If you  are looking for a counterexample in finite case, then there are more sophisticated examples, see this post: Does the order, lattice of subgroups, and lattice of factor groups, uniquely determine a group up to isomorphism?
Denote by $sub(G)$ a collection of all proper subgroups of $G$. The post above shows that there are two finite groups $G$ and $H$ such that there is a bijection $f:sub(G)\to sub(H)$ such that $X\simeq f(X)$, yet $G$ and $H$ are not isomorphic. The post above gives example of even stronger condition, that additionaly factor groups are isomorphic.
Yes, groups are weird.
