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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

d = A("d")
f = B("f")
i = C("i")
c = D("c")
l = E("l")
m = D("m")
g = B("g")
h = D("h")

d.q = i
d.u = h
d.r = h
d.x = f
f.p = d
f.v = l
i.t = h
c.y = i
c.s = l
l.p = d
l.u = i
l.q = m
m.y = i
m.s = l
g.p = d
g.v = l
h.y = i
h.s = l
assert l.q.s.u.t.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: D = None
        self.x: B = None
        self.r: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

d = A("d")
f = B("f")
i = C("i")
c = D("c")
l = E("l")
m = D("m")
g = B("g")
h = D("h")

d.q = i
d.u = h
d.r = h
d.x = f
f.p = d
f.v = l
i.t = h
c.y = i
c.s = l
l.p = d
l.u = i
l.q = m
m.y = i
m.s = l
g.p = d
g.v = l
h.y = i
h.s = l
assert l.q.s.u.t.y.t.txt == "h"