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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: B = None
        self.y: E = None
        self.q: E = None
        self.txt = txt

d = A("d")
n = B("n")
h = C("h")
j = D("j")
g = E("g")
m = D("m")
i = E("i")
e = D("e")
b = E("b")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: B = None
        self.y: E = None
        self.q: E = None
        self.txt = txt

d = A("d")
n = B("n")
h = C("h")
j = D("j")
g = E("g")
m = D("m")
i = E("i")
e = D("e")
b = E("b")

d.s = h
d.q = h
d.z = e
n.o = h
h.q = n
h.z = d
h.p = m
j.x = d
j.r = m
g.x = i
g.t = n
g.y = b
g.q = b
m.x = d
m.r = e
i.x = g
i.t = n
i.y = b
i.q = b
e.x = d
e.r = j
b.x = g
b.y = g
b.q = g
b.t = n
assert j.x.z.r.txt == "j"