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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: A = None
        self.o: B = None
        self.z: A = None
        self.txt = txt

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

d = A("d")
f = B("f")
b = C("b")
e = D("e")
j = A("j")
c = A("c")
l = B("l")

d.u = b
d.s = b
d.w = e
d.p = j
f.t = j
f.w = c
f.z = e
b.x = e
b.y = d
b.o = l
b.z = j
e.w = b
e.y = d
j.u = b
j.s = b
j.w = e
j.p = d
c.u = b
c.s = b
c.w = e
c.p = j
l.t = d
l.w = c
l.z = e
assert b.z.w.w.y.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: C = None
        self.w: D = None
        self.p: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: A = None
        self.o: B = None
        self.z: A = None
        self.txt = txt

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

d = A("d")
f = B("f")
b = C("b")
e = D("e")
j = A("j")
c = A("c")
l = B("l")

d.u = b
d.s = b
d.w = e
d.p = j
f.t = j
f.w = c
f.z = e
b.x = e
b.y = d
b.o = l
b.z = j
e.w = b
e.y = d
j.u = b
j.s = b
j.w = e
j.p = d
c.u = b
c.s = b
c.w = e
c.p = j
l.t = d
l.w = c
l.z = e
assert b.z.w.w.y.s.z.txt == "j"