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

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

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

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

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

f = A("f")
g = B("g")
i = C("i")
d = D("d")
e = E("e")
m = A("m")
n = D("n")
l = E("l")
b = E("b")

f.v = g
f.y = g
f.z = i
f.u = b
g.s = n
i.s = n
d.x = g
d.z = g
d.y = i
d.r = i
e.s = f
e.y = n
m.v = g
m.y = g
m.z = i
m.u = b
n.x = g
n.z = g
n.y = i
n.r = i
l.s = m
l.y = d
b.s = f
b.y = d
assert g.s.r.s.z.s.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: B = None
        self.z: C = None
        self.u: E = None
        self.txt = txt

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

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

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

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

f = A("f")
g = B("g")
i = C("i")
d = D("d")
e = E("e")
m = A("m")
n = D("n")
l = E("l")
b = E("b")

f.v = g
f.y = g
f.z = i
f.u = b
g.s = n
i.s = n
d.x = g
d.z = g
d.y = i
d.r = i
e.s = f
e.y = n
m.v = g
m.y = g
m.z = i
m.u = b
n.x = g
n.z = g
n.y = i
n.r = i
l.s = m
l.y = d
b.s = f
b.y = d
assert g.s.r.s.z.s.z.s.txt == "n"