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

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

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

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

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

g = A("g")
f = B("f")
d = C("d")
b = D("b")
a = E("a")
c = A("c")
k = A("k")
m = A("m")

g.y = d
f.z = m
f.r = c
f.t = d
d.x = f
d.w = f
b.y = c
a.w = f
a.v = b
a.z = d
a.y = c
c.y = d
k.y = d
m.y = d
assert a.v.y.y.x.z.y.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

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

g = A("g")
f = B("f")
d = C("d")
b = D("b")
a = E("a")
c = A("c")
k = A("k")
m = A("m")

g.y = d
f.z = m
f.r = c
f.t = d
d.x = f
d.w = f
b.y = c
a.w = f
a.v = b
a.z = d
a.y = c
c.y = d
k.y = d
m.y = d
assert a.v.y.y.x.z.y.w.t.txt == "d"