class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: H = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: E = None
        self.v: B = None
        self.x: G = None
        self.z: C = None
        self.u: C = None
        self.q: F = None
        self.y: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: D = None
        self.z: F = None
        self.u: G = None
        self.q: D = None
        self.x: D = None
        self.v: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: C = None
        self.u: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.y: G = None
        self.w: D = None
        self.txt = txt

m = A("m")
a = B("a")
d = C("d")
f = D("f")
c = E("c")
g = F("g")
n = G("n")
l = H("l")

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: E = None
        self.v: B = None
        self.x: G = None
        self.z: C = None
        self.u: C = None
        self.q: F = None
        self.y: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: D = None
        self.z: F = None
        self.u: G = None
        self.q: D = None
        self.x: D = None
        self.v: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: C = None
        self.u: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.y: G = None
        self.w: D = None
        self.txt = txt

m = A("m")
a = B("a")
d = C("d")
f = D("f")
c = E("c")
g = F("g")
n = G("n")
l = H("l")

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