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

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

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

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

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

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

j.s = m
j.w = n
b.z = f
b.w = k
b.t = j
k.z = b
n.y = m
n.v = f
n.z = f
i.v = j
i.z = f
i.p = a
a.v = j
a.z = f
a.p = i
m.z = k
m.w = f
m.t = j
f.z = b
assert b.w.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

j.s = m
j.w = n
b.z = f
b.w = k
b.t = j
k.z = b
n.y = m
n.v = f
n.z = f
i.v = j
i.z = f
i.p = a
a.v = j
a.z = f
a.p = i
m.z = k
m.w = f
m.t = j
f.z = b
assert b.w.z.z.z.z.z.z.txt == "f"