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

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

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

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

j = A("j")
k = B("k")
f = C("f")
l = D("l")
i = A("i")

j.z = k
j.r = f
k.o = f
f.s = l
f.y = l
f.u = l
f.v = k
l.y = i
l.r = k
l.x = k
i.z = k
i.r = f
assert l.y.r.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: C = None
        self.txt = txt

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

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

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

j = A("j")
k = B("k")
f = C("f")
l = D("l")
i = A("i")

j.z = k
j.r = f
k.o = f
f.s = l
f.y = l
f.u = l
f.v = k
l.y = i
l.r = k
l.x = k
i.z = k
i.r = f
assert l.y.r.v.o.txt == "f"