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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: D = None
        self.r: C = None
        self.o: B = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: D = None
        self.r: C = None
        self.o: B = None
        self.txt = txt

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

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

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

c.s = d
c.z = f
c.q = l
c.p = l
k.y = l
k.w = l
k.r = d
k.o = n
d.p = l
l.x = d
f.s = d
f.z = c
f.q = l
f.p = l
n.y = l
n.w = l
n.r = d
n.o = k
assert c.z.q.x.p.x.txt == "d"