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

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

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

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

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

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

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

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

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

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

e.o = k
e.s = l
f.o = a
f.q = k
f.z = c
f.u = l
a.r = l
c.x = f
c.s = a
k.o = e
k.s = l
l.o = a
l.q = k
l.z = c
l.u = f
assert a.r.z.s.r.o.r.txt == "l"