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

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

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

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

k = A("k")
e = B("e")
l = C("l")
i = D("i")
m = D("m")
b = D("b")

k.x = l
k.o = l
k.r = e
e.q = l
e.w = l
e.o = l
e.y = b
l.z = i
l.r = k
i.w = k
i.o = k
m.w = k
m.o = k
b.w = k
b.o = k
assert i.w.x.z.w.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: C = None
        self.r: B = None
        self.txt = txt

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

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

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

k = A("k")
e = B("e")
l = C("l")
i = D("i")
m = D("m")
b = D("b")

k.x = l
k.o = l
k.r = e
e.q = l
e.w = l
e.o = l
e.y = b
l.z = i
l.r = k
i.w = k
i.o = k
m.w = k
m.o = k
b.w = k
b.o = k
assert i.w.x.z.w.x.z.txt == "i"