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

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

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

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

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

k.o = l
n.r = l
c.q = n
l.y = c
l.w = a
l.x = a
l.t = n
a.q = n
assert n.r.t.r.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

k.o = l
n.r = l
c.q = n
l.y = c
l.w = a
l.x = a
l.t = n
a.q = n
assert n.r.t.r.t.r.txt == "l"