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

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

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

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

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

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

e.x = f
e.z = m
e.y = g
c.u = f
c.r = f
c.v = i
c.z = i
c.y = a
m.u = n
m.v = n
m.z = e
m.w = a
g.u = e
g.r = f
n.w = g
i.u = e
i.r = m
a.w = i
j.u = a
j.v = a
j.z = e
j.w = n
f.u = n
f.v = n
f.w = n
f.z = e
assert i.u.y.u.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: C = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

e.x = f
e.z = m
e.y = g
c.u = f
c.r = f
c.v = i
c.z = i
c.y = a
m.u = n
m.v = n
m.z = e
m.w = a
g.u = e
g.r = f
n.w = g
i.u = e
i.r = m
a.w = i
j.u = a
j.v = a
j.z = e
j.w = n
f.u = n
f.v = n
f.w = n
f.z = e
assert i.u.y.u.z.u.txt == "n"