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

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

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

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

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

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

d.s = c
d.x = c
d.r = g
d.p = b
h.o = a
h.s = a
h.z = c
h.v = c
h.q = j
g.z = b
g.t = m
a.t = h
j.w = h
j.r = d
m.w = h
m.r = n
b.s = h
b.r = g
b.p = d
b.x = c
c.o = a
c.s = a
c.z = h
c.v = h
c.q = j
n.s = h
n.x = h
n.r = g
n.p = b
assert d.r.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: C = None
        self.p: A = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

d.s = c
d.x = c
d.r = g
d.p = b
h.o = a
h.s = a
h.z = c
h.v = c
h.q = j
g.z = b
g.t = m
a.t = h
j.w = h
j.r = d
m.w = h
m.r = n
b.s = h
b.r = g
b.p = d
b.x = c
c.o = a
c.s = a
c.z = h
c.v = h
c.q = j
n.s = h
n.x = h
n.r = g
n.p = b
assert d.r.t.r.txt == "n"