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

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

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

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

e = A("e")
c = B("c")
f = C("f")
n = D("n")

e.s = n
e.u = n
c.v = f
c.q = f
c.w = f
f.u = c
f.v = e
f.z = e
f.t = e
n.t = f
n.q = e
assert f.u.w.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: D = None
        self.txt = txt

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

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

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

e = A("e")
c = B("c")
f = C("f")
n = D("n")

e.s = n
e.u = n
c.v = f
c.q = f
c.w = f
f.u = c
f.v = e
f.z = e
f.t = e
n.t = f
n.q = e
assert f.u.w.u.v.txt == "f"