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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: B = None
        self.p: A = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: B = None
        self.s: B = None
        self.p: B = None
        self.txt = txt

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

f.y = l
f.t = l
b.q = l
b.t = l
b.y = l
m.t = l
m.u = b
m.p = f
m.r = n
l.z = b
l.v = b
l.s = b
l.p = b
n.y = l
n.t = l
assert m.u.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: B = None
        self.p: A = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: B = None
        self.s: B = None
        self.p: B = None
        self.txt = txt

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

f.y = l
f.t = l
b.q = l
b.t = l
b.y = l
m.t = l
m.u = b
m.p = f
m.r = n
l.z = b
l.v = b
l.s = b
l.p = b
n.y = l
n.t = l
assert m.u.y.s.txt == "b"