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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: B = None
        self.w: C = None
        self.p: E = None
        self.txt = txt

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

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

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

j = A("j")
d = B("d")
f = C("f")
c = D("c")
h = E("h")
l = D("l")
e = B("e")

j.x = h
d.q = c
d.t = e
d.w = f
d.p = h
f.y = j
c.r = l
c.u = h
h.t = f
h.u = j
l.r = c
l.u = h
e.q = c
e.t = d
e.w = f
e.p = h
assert h.t.y.x.u.x.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: B = None
        self.w: C = None
        self.p: E = None
        self.txt = txt

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

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

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

j = A("j")
d = B("d")
f = C("f")
c = D("c")
h = E("h")
l = D("l")
e = B("e")

j.x = h
d.q = c
d.t = e
d.w = f
d.p = h
f.y = j
c.r = l
c.u = h
h.t = f
h.u = j
l.r = c
l.u = h
e.q = c
e.t = d
e.w = f
e.p = h
assert h.t.y.x.u.x.u.x.txt == "h"