class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: A = None
        self.txt = txt

m = A("m")
i = B("i")
n = A("n")
e = A("e")
h = A("h")

m.v = i
m.w = i
i.o = n
i.u = n
n.v = i
n.w = i
e.v = i
e.w = i
h.v = i
h.w = i
assert i.o.v.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: A = None
        self.txt = txt

m = A("m")
i = B("i")
n = A("n")
e = A("e")
h = A("h")

m.v = i
m.w = i
i.o = n
i.u = n
n.v = i
n.w = i
e.v = i
e.w = i
h.v = i
h.w = i
assert i.o.v.o.w.txt == "i"