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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: B = None
        self.w: D = None
        self.u: B = None
        self.x: A = None
        self.txt = txt

d = A("d")
e = B("e")
c = C("c")
m = D("m")
f = E("f")
g = F("g")
j = D("j")
a = B("a")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: B = None
        self.w: D = None
        self.u: B = None
        self.x: A = None
        self.txt = txt

d = A("d")
e = B("e")
c = C("c")
m = D("m")
f = E("f")
g = F("g")
j = D("j")
a = B("a")

d.p = j
d.y = c
d.z = c
e.u = m
e.p = a
e.q = f
e.r = j
c.u = m
c.s = d
c.y = d
m.y = d
m.o = d
m.u = j
m.q = a
f.q = g
f.o = g
f.s = c
f.x = a
f.t = m
f.z = m
g.o = c
g.q = e
g.u = e
g.w = m
g.x = d
j.y = d
j.o = d
j.u = m
j.q = a
a.u = j
a.p = e
a.q = f
a.r = m
assert m.q.u.q.p.r.u.txt == "m"