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

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

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

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

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

k = A("k")
n = B("n")
f = C("f")
j = D("j")
g = E("g")
c = C("c")
h = C("h")

k.q = h
n.s = j
n.o = g
n.x = g
n.q = k
f.p = n
f.x = n
f.t = n
f.s = k
f.u = j
j.s = k
g.t = n
g.o = k
c.p = n
c.x = n
c.t = n
c.s = k
c.u = j
h.p = n
h.x = n
h.t = n
h.s = k
h.u = j
assert h.u.s.q.x.q.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

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

k = A("k")
n = B("n")
f = C("f")
j = D("j")
g = E("g")
c = C("c")
h = C("h")

k.q = h
n.s = j
n.o = g
n.x = g
n.q = k
f.p = n
f.x = n
f.t = n
f.s = k
f.u = j
j.s = k
g.t = n
g.o = k
c.p = n
c.x = n
c.t = n
c.s = k
c.u = j
h.p = n
h.x = n
h.t = n
h.s = k
h.u = j
assert h.u.s.q.x.q.q.p.txt == "n"