class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: B = None
        self.z: C = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: B = None
        self.p: A = None
        self.t: D = None
        self.txt = txt

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

l = A("l")
h = B("h")
c = C("c")
g = D("g")
d = A("d")

l.t = h
l.u = h
l.v = h
l.z = c
h.u = d
h.w = d
h.o = l
c.v = h
c.z = h
c.p = l
c.t = g
g.o = d
d.t = h
d.u = h
d.v = h
d.z = c
assert g.o.u.u.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: B = None
        self.z: C = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: B = None
        self.p: A = None
        self.t: D = None
        self.txt = txt

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

l = A("l")
h = B("h")
c = C("c")
g = D("g")
d = A("d")

l.t = h
l.u = h
l.v = h
l.z = c
h.u = d
h.w = d
h.o = l
c.v = h
c.z = h
c.p = l
c.t = g
g.o = d
d.t = h
d.u = h
d.v = h
d.z = c
assert g.o.u.u.t.w.txt == "d"