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

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

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

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

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

c.x = a
c.p = j
f.s = c
f.u = c
f.w = h
f.z = l
l.o = f
l.t = a
l.x = a
l.z = j
j.u = a
h.s = c
h.u = c
h.w = f
h.z = a
a.o = h
a.t = l
a.x = l
a.z = j
assert h.u.p.u.x.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: D = None
        self.txt = txt

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

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

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

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

c.x = a
c.p = j
f.s = c
f.u = c
f.w = h
f.z = l
l.o = f
l.t = a
l.x = a
l.z = j
j.u = a
h.s = c
h.u = c
h.w = f
h.z = a
a.o = h
a.t = l
a.x = l
a.z = j
assert h.u.p.u.x.z.u.txt == "a"