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

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

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

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

b = A("b")
k = B("k")
c = C("c")
i = D("i")
n = C("n")

b.z = i
b.u = i
b.o = c
k.v = n
c.r = n
i.y = c
n.r = c
assert n.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: D = None
        self.o: C = None
        self.txt = txt

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

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

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

b = A("b")
k = B("k")
c = C("c")
i = D("i")
n = C("n")

b.z = i
b.u = i
b.o = c
k.v = n
c.r = n
i.y = c
n.r = c
assert n.r.r.r.r.r.txt == "c"