class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: B = None
        self.y: E = None
        self.v: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: B = None
        self.txt = txt

m = A("m")
h = B("h")
e = C("e")
d = D("d")
l = E("l")
i = F("i")
a = E("a")

m.o = i
m.v = i
m.z = h
m.y = a
h.u = d
e.x = h
d.p = e
d.w = m
d.t = l
l.o = m
i.q = a
i.u = h
a.o = m
assert e.x.u.w.y.o.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: B = None
        self.y: E = None
        self.v: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: B = None
        self.txt = txt

m = A("m")
h = B("h")
e = C("e")
d = D("d")
l = E("l")
i = F("i")
a = E("a")

m.o = i
m.v = i
m.z = h
m.y = a
h.u = d
e.x = h
d.p = e
d.w = m
d.t = l
l.o = m
i.q = a
i.u = h
a.o = m
assert e.x.u.w.y.o.y.o.txt == "m"