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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: D = None
        self.s: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

h = A("h")
f = B("f")
j = C("j")
g = D("g")
l = D("l")

h.o = j
f.v = l
f.z = g
f.s = g
j.p = f
j.v = g
j.u = l
g.q = j
l.q = j
assert h.o.v.q.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: D = None
        self.s: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

h = A("h")
f = B("f")
j = C("j")
g = D("g")
l = D("l")

h.o = j
f.v = l
f.z = g
f.s = g
j.p = f
j.v = g
j.u = l
g.q = j
l.q = j
assert h.o.v.q.p.z.txt == "g"