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

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

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

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

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

i = A("i")
a = B("a")
j = C("j")
c = D("c")
g = E("g")
e = B("e")
h = D("h")
f = E("f")

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

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

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

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

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

i = A("i")
a = B("a")
j = C("j")
c = D("c")
g = E("g")
e = B("e")
h = D("h")
f = E("f")

i.s = a
i.u = c
a.u = e
j.t = a
c.r = h
g.y = f
e.u = a
h.r = c
f.y = g
assert a.u.u.u.u.txt == "a"