ὅταν γὰρ εἰς τὸ αὐτὸ ἔλθωσιν ἐραστής τε καὶ παιδικά, νόμον ἔχων ἑκάτερος, ὁ μὲν χαρισαμένοις παιδικοῖς ὑπηρετῶν ὁτιοῦν δικαίως ἂν ὑπηρετεῖν, ὁ δὲ τῷ ποιοῦντι αὐτὸν σοφόν τε καὶ ἀγαθὸν δικαίως αὖ ὁτιοῦν ἂν ὑπουργεῖν <ὑπουργῶν>, on what does the infinitive of ὑπηρετεῖν depend.
ὑπηρετῶν ![]()
I would rather think that this inf explains νόμον, that is a law to serve justly, that is each of them both having a law: the one serving in whatever way the responding paidika (having a law) to serve justly etc