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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: D = None
        self.t: A = None
        self.w: B = None
        self.txt = txt

d = A("d")
f = B("f")
e = C("e")
l = D("l")
k = C("k")
c = D("c")
n = D("n")
m = A("m")

d.u = f
d.s = m
d.x = m
d.o = e
f.v = k
f.u = c
f.q = l
e.o = f
e.s = f
e.t = f
e.w = f
l.z = m
l.t = m
l.p = c
l.w = f
k.o = f
k.s = f
k.t = f
k.w = f
c.z = d
c.p = n
c.t = m
c.w = f
n.z = m
n.t = m
n.p = c
n.w = f
m.u = f
m.s = d
m.x = d
m.o = k
assert l.w.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: A = None
        self.o: C = None
        self.x: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: D = None
        self.t: A = None
        self.w: B = None
        self.txt = txt

d = A("d")
f = B("f")
e = C("e")
l = D("l")
k = C("k")
c = D("c")
n = D("n")
m = A("m")

d.u = f
d.s = m
d.x = m
d.o = e
f.v = k
f.u = c
f.q = l
e.o = f
e.s = f
e.t = f
e.w = f
l.z = m
l.t = m
l.p = c
l.w = f
k.o = f
k.s = f
k.t = f
k.w = f
c.z = d
c.p = n
c.t = m
c.w = f
n.z = m
n.t = m
n.p = c
n.w = f
m.u = f
m.s = d
m.x = d
m.o = k
assert l.w.v.t.txt == "f"