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

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

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

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

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

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

j.s = e
j.w = e
j.x = m
j.y = m
g.x = b
g.z = c
g.u = j
g.p = m
f.z = j
f.s = n
e.t = c
e.w = j
m.y = j
n.z = j
n.s = f
c.t = e
c.w = j
b.x = g
b.z = e
b.u = j
b.p = m
assert f.z.y.y.y.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: E = None
        self.w: D = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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

j.s = e
j.w = e
j.x = m
j.y = m
g.x = b
g.z = c
g.u = j
g.p = m
f.z = j
f.s = n
e.t = c
e.w = j
m.y = j
n.z = j
n.s = f
c.t = e
c.w = j
b.x = g
b.z = e
b.u = j
b.p = m
assert f.z.y.y.y.y.w.txt == "e"