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

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

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

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

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

e = A("e")
l = B("l")
c = C("c")
j = D("j")
g = E("g")
a = B("a")
h = E("h")
i = B("i")

e.o = i
e.u = a
l.p = j
l.q = a
c.x = e
j.p = g
j.t = e
g.x = e
g.z = c
a.p = j
a.q = l
h.x = e
h.z = c
i.p = j
i.q = l
assert j.t.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

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

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

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

e = A("e")
l = B("l")
c = C("c")
j = D("j")
g = E("g")
a = B("a")
h = E("h")
i = B("i")

e.o = i
e.u = a
l.p = j
l.q = a
c.x = e
j.p = g
j.t = e
g.x = e
g.z = c
a.p = j
a.q = l
h.x = e
h.z = c
i.p = j
i.q = l
assert j.t.u.q.txt == "l"