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

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

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

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

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

a = A("a")
m = B("m")
e = C("e")
g = D("g")
f = E("f")
j = A("j")
d = E("d")

a.p = f
a.t = m
a.y = m
m.y = f
e.z = m
e.s = g
e.x = f
e.r = j
e.v = j
g.u = m
g.s = m
g.q = d
f.t = g
f.v = d
j.p = f
j.t = m
j.y = m
d.t = g
d.v = f
assert e.z.y.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: B = None
        self.y: B = None
        self.txt = txt

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

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

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

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

a = A("a")
m = B("m")
e = C("e")
g = D("g")
f = E("f")
j = A("j")
d = E("d")

a.p = f
a.t = m
a.y = m
m.y = f
e.z = m
e.s = g
e.x = f
e.r = j
e.v = j
g.u = m
g.s = m
g.q = d
f.t = g
f.v = d
j.p = f
j.t = m
j.y = m
d.t = g
d.v = f
assert e.z.y.v.v.txt == "f"