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

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

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

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

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

f = A("f")
j = B("j")
d = C("d")
i = D("i")
b = E("b")
n = D("n")
a = D("a")

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

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

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

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

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

f = A("f")
j = B("j")
d = C("d")
i = D("i")
b = E("b")
n = D("n")
a = D("a")

f.s = d
f.r = j
j.v = f
j.w = f
j.z = d
d.x = f
d.s = f
d.y = a
d.w = a
d.r = n
i.t = b
i.w = b
i.o = f
b.r = i
b.y = f
n.t = b
n.w = b
n.o = f
a.t = b
a.w = b
a.o = f
assert d.w.t.r.o.r.z.txt == "d"