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

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

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

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

l = A("l")
k = B("k")
c = C("c")
g = D("g")
m = D("m")

l.s = c
l.w = c
l.t = k
l.r = m
k.s = l
k.z = c
k.o = m
c.x = l
g.y = l
g.o = l
g.q = k
m.y = l
m.o = l
m.q = k
assert k.o.q.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: C = None
        self.t: B = None
        self.r: D = None
        self.txt = txt

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

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

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

l = A("l")
k = B("k")
c = C("c")
g = D("g")
m = D("m")

l.s = c
l.w = c
l.t = k
l.r = m
k.s = l
k.z = c
k.o = m
c.x = l
g.y = l
g.o = l
g.q = k
m.y = l
m.o = l
m.q = k
assert k.o.q.s.t.txt == "k"