class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: B = None
        self.v: C = None
        self.s: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: A = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: A = None
        self.q: B = None
        self.txt = txt

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

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

h.q = a
h.o = b
h.v = g
h.s = c
b.t = h
d.p = i
d.x = g
d.t = a
c.x = h
c.z = h
c.q = b
a.u = g
a.z = f
i.p = d
i.x = g
i.t = a
g.p = d
g.x = d
g.t = a
j.x = h
j.z = h
j.q = b
f.x = h
f.z = h
f.q = b
assert h.q.u.p.p.p.t.u.txt == "g"