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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: A = None
        self.p: D = None
        self.txt = txt

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

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

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

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

h.o = f
h.q = g
h.r = c
h.t = j
l.o = h
l.w = h
l.p = g
d.p = h
d.w = b
d.v = l
c.u = h
c.x = g
c.s = g
j.z = f
j.y = h
f.z = j
f.y = h
g.u = h
g.x = c
g.s = c
b.p = h
b.w = d
b.v = l
assert g.s.s.x.u.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.q: D = None
        self.r: D = None
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: A = None
        self.p: D = None
        self.txt = txt

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

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

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

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

h.o = f
h.q = g
h.r = c
h.t = j
l.o = h
l.w = h
l.p = g
d.p = h
d.w = b
d.v = l
c.u = h
c.x = g
c.s = g
j.z = f
j.y = h
f.z = j
f.y = h
g.u = h
g.x = c
g.s = c
b.p = h
b.w = d
b.v = l
assert g.s.s.x.u.r.u.txt == "h"