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

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

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

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

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

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

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

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

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

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

b.w = a
b.z = a
b.u = k
b.o = k
a.r = k
a.t = k
a.o = c
k.s = a
c.x = a
c.q = k
e.w = a
e.z = a
e.u = k
e.o = k
assert b.w.r.s.o.q.txt == "k"