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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: B = None
        self.p: E = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: E = None
        self.q: E = None
        self.s: C = None
        self.t: E = None
        self.txt = txt

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

i = A("i")
k = B("k")
b = C("b")
n = D("n")
g = E("g")
d = B("d")
c = B("c")
j = E("j")
f = E("f")

i.z = b
i.w = f
k.r = j
k.z = n
b.t = d
b.x = k
b.p = j
b.r = g
n.p = c
n.w = g
n.t = g
n.q = f
n.s = b
g.t = i
d.r = f
d.z = n
c.r = j
c.z = n
j.t = i
f.t = i
assert d.z.s.t.r.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: B = None
        self.p: E = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: E = None
        self.q: E = None
        self.s: C = None
        self.t: E = None
        self.txt = txt

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

i = A("i")
k = B("k")
b = C("b")
n = D("n")
g = E("g")
d = B("d")
c = B("c")
j = E("j")
f = E("f")

i.z = b
i.w = f
k.r = j
k.z = n
b.t = d
b.x = k
b.p = j
b.r = g
n.p = c
n.w = g
n.t = g
n.q = f
n.s = b
g.t = i
d.r = f
d.z = n
c.r = j
c.z = n
j.t = i
f.t = i
assert d.z.s.t.r.t.w.txt == "f"