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

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

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

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

f = A("f")
i = B("i")
c = C("c")
l = D("l")

f.v = c
i.z = f
i.u = f
c.y = l
l.y = c
l.r = i
assert l.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

f = A("f")
i = B("i")
c = C("c")
l = D("l")

f.v = c
i.z = f
i.u = f
c.y = l
l.y = c
l.r = i
assert l.y.y.y.y.txt == "l"