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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: B = None
        self.t: A = None
        self.w: A = None
        self.txt = txt

j = A("j")
e = B("e")
l = C("l")
m = D("m")
g = E("g")
h = A("h")

j.s = m
j.u = e
e.u = m
l.w = j
l.q = m
m.u = e
g.u = h
g.t = h
g.x = e
g.w = j
h.s = m
h.u = e
assert g.t.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: B = None
        self.t: A = None
        self.w: A = None
        self.txt = txt

j = A("j")
e = B("e")
l = C("l")
m = D("m")
g = E("g")
h = A("h")

j.s = m
j.u = e
e.u = m
l.w = j
l.q = m
m.u = e
g.u = h
g.t = h
g.x = e
g.w = j
h.s = m
h.u = e
assert g.t.u.u.u.u.u.txt == "e"