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

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

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

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

d = A("d")
l = B("l")
c = C("c")
f = D("f")
b = A("b")
a = D("a")
n = B("n")

d.s = b
d.x = b
d.t = n
d.y = c
l.w = a
l.s = a
l.z = n
c.t = f
c.y = b
c.r = b
c.w = l
f.v = d
f.s = n
f.z = a
b.s = d
b.x = d
b.t = n
b.y = c
a.v = b
a.s = n
a.z = f
n.w = f
n.s = f
n.z = l
assert c.w.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: A = None
        self.t: B = None
        self.y: C = None
        self.txt = txt

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

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

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

d = A("d")
l = B("l")
c = C("c")
f = D("f")
b = A("b")
a = D("a")
n = B("n")

d.s = b
d.x = b
d.t = n
d.y = c
l.w = a
l.s = a
l.z = n
c.t = f
c.y = b
c.r = b
c.w = l
f.v = d
f.s = n
f.z = a
b.s = d
b.x = d
b.t = n
b.y = c
a.v = b
a.s = n
a.z = f
n.w = f
n.s = f
n.z = l
assert c.w.z.w.txt == "f"