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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: E = None
        self.t: D = None
        self.o: B = None
        self.x: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: E = None
        self.t: D = None
        self.o: B = None
        self.x: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

m.p = c
n.u = f
n.z = e
n.x = j
j.r = h
j.s = h
j.t = c
j.o = e
j.x = e
c.q = d
h.r = j
f.q = d
e.u = d
e.z = n
e.x = j
g.u = c
g.z = n
g.x = j
d.q = f
k.q = d
assert j.t.q.q.txt == "f"