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

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: B = None
        self.v: B = None
        self.r: A = None
        self.txt = txt

c = A("c")
a = B("a")
l = C("l")
i = D("i")
e = C("e")
k = B("k")
j = B("j")

c.s = l
c.z = i
a.o = c
l.p = e
l.r = e
l.z = e
l.o = a
i.t = c
i.r = c
i.o = a
i.v = k
e.p = l
e.r = l
e.z = l
e.o = k
k.o = c
j.o = c
assert i.r.s.o.o.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: B = None
        self.v: B = None
        self.r: A = None
        self.txt = txt

c = A("c")
a = B("a")
l = C("l")
i = D("i")
e = C("e")
k = B("k")
j = B("j")

c.s = l
c.z = i
a.o = c
l.p = e
l.r = e
l.z = e
l.o = a
i.t = c
i.r = c
i.o = a
i.v = k
e.p = l
e.r = l
e.z = l
e.o = k
k.o = c
j.o = c
assert i.r.s.o.o.z.o.txt == "a"