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

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

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

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

l = A("l")
b = B("b")
e = C("e")
f = D("f")
n = A("n")

l.y = b
l.q = e
b.t = e
e.q = b
e.s = f
f.v = n
f.y = n
f.s = n
n.y = b
n.q = e
assert n.q.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: C = None
        self.txt = txt

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

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

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

l = A("l")
b = B("b")
e = C("e")
f = D("f")
n = A("n")

l.y = b
l.q = e
b.t = e
e.q = b
e.s = f
f.v = n
f.y = n
f.s = n
n.y = b
n.q = e
assert n.q.s.y.txt == "n"