class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: B = None
        self.txt = txt

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

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

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

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

c.z = f
c.y = h
f.s = c
f.x = k
f.o = k
f.q = i
i.r = l
i.z = c
k.y = l
h.s = c
h.x = k
h.o = k
h.q = i
l.z = f
l.y = h
assert l.z.x.y.z.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: B = None
        self.txt = txt

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

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

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

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

c.z = f
c.y = h
f.s = c
f.x = k
f.o = k
f.q = i
i.r = l
i.z = c
k.y = l
h.s = c
h.x = k
h.o = k
h.q = i
l.z = f
l.y = h
assert l.z.x.y.z.q.z.txt == "c"