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

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

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

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

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

i = A("i")
h = B("h")
f = C("f")
j = D("j")
m = E("m")
e = D("e")

i.t = j
h.u = i
h.s = i
h.z = f
f.w = j
j.y = e
j.s = m
j.u = f
m.t = e
m.s = i
m.p = j
e.y = j
e.s = m
e.u = f
assert e.y.u.w.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

i = A("i")
h = B("h")
f = C("f")
j = D("j")
m = E("m")
e = D("e")

i.t = j
h.u = i
h.s = i
h.z = f
f.w = j
j.y = e
j.s = m
j.u = f
m.t = e
m.s = i
m.p = j
e.y = j
e.s = m
e.u = f
assert e.y.u.w.s.s.txt == "i"