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

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

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

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

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

c.r = e
n.y = l
n.s = j
n.z = c
n.o = k
e.z = l
j.o = l
j.y = e
j.t = e
j.r = e
k.r = e
l.y = n
l.s = j
l.z = c
l.o = c
assert k.r.z.s.o.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

c.r = e
n.y = l
n.s = j
n.z = c
n.o = k
e.z = l
j.o = l
j.y = e
j.t = e
j.r = e
k.r = e
l.y = n
l.s = j
l.z = c
l.o = c
assert k.r.z.s.o.y.y.txt == "l"