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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.t: D = None
        self.q: A = None
        self.txt = txt

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

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

c = A("c")
j = B("j")
f = C("f")
l = D("l")
d = B("d")
i = D("i")
k = C("k")

c.p = j
c.y = j
c.x = f
c.u = d
j.x = i
j.s = l
j.t = l
j.q = c
f.p = k
f.z = c
f.r = i
l.w = d
l.o = c
l.u = i
l.x = i
d.x = i
d.s = l
d.t = l
d.q = c
i.w = d
i.o = c
i.u = l
i.x = l
k.p = f
k.z = c
k.r = i
assert c.x.p.p.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: C = None
        self.u: B = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.t: D = None
        self.q: A = None
        self.txt = txt

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

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

c = A("c")
j = B("j")
f = C("f")
l = D("l")
d = B("d")
i = D("i")
k = C("k")

c.p = j
c.y = j
c.x = f
c.u = d
j.x = i
j.s = l
j.t = l
j.q = c
f.p = k
f.z = c
f.r = i
l.w = d
l.o = c
l.u = i
l.x = i
d.x = i
d.s = l
d.t = l
d.q = c
i.w = d
i.o = c
i.u = l
i.x = l
k.p = f
k.z = c
k.r = i
assert c.x.p.p.z.u.txt == "d"