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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: C = None
        self.p: A = None
        self.y: D = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: C = None
        self.p: A = None
        self.y: D = None
        self.v: C = None
        self.txt = txt

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

h.x = f
e.u = d
e.z = c
e.y = f
l.w = h
l.v = h
l.x = h
l.u = e
c.u = f
c.w = a
f.z = l
f.t = a
f.v = a
f.p = h
f.y = c
d.u = e
d.z = c
d.y = f
a.w = h
a.v = h
a.x = h
a.u = e
assert l.u.u.y.p.x.y.w.txt == "a"