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

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

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

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

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

i = A("i")
f = B("f")
h = C("h")
m = D("m")
l = E("l")
g = E("g")
e = A("e")
c = A("c")

i.y = f
f.u = e
f.t = m
f.r = m
f.x = h
h.s = f
m.t = h
l.z = g
l.t = g
g.z = l
g.t = l
e.y = f
c.y = f
assert e.y.u.y.u.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

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

i = A("i")
f = B("f")
h = C("h")
m = D("m")
l = E("l")
g = E("g")
e = A("e")
c = A("c")

i.y = f
f.u = e
f.t = m
f.r = m
f.x = h
h.s = f
m.t = h
l.z = g
l.t = g
g.z = l
g.t = l
e.y = f
c.y = f
assert e.y.u.y.u.y.u.y.txt == "f"