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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: C = None
        self.q: E = None
        self.y: E = None
        self.p: D = None
        self.txt = txt

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

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

m.y = i
n.y = e
n.s = e
n.z = j
n.p = j
n.v = j
j.u = i
c.v = i
c.q = i
c.y = i
c.w = j
c.p = e
i.p = f
i.u = m
i.w = e
b.v = i
b.q = i
b.y = i
b.w = j
b.p = f
e.v = i
e.q = i
e.y = i
e.w = j
e.p = f
k.y = i
f.v = i
f.q = i
f.y = i
f.w = j
f.p = b
assert f.w.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: C = None
        self.q: E = None
        self.y: E = None
        self.p: D = None
        self.txt = txt

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

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

m.y = i
n.y = e
n.s = e
n.z = j
n.p = j
n.v = j
j.u = i
c.v = i
c.q = i
c.y = i
c.w = j
c.p = e
i.p = f
i.u = m
i.w = e
b.v = i
b.q = i
b.y = i
b.w = j
b.p = f
e.v = i
e.q = i
e.y = i
e.w = j
e.p = f
k.y = i
f.v = i
f.q = i
f.y = i
f.w = j
f.p = b
assert f.w.u.p.txt == "f"