class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: B = None
        self.t: E = None
        self.r: D = None
        self.o: G = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.q: F = None
        self.r: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: D = None
        self.w: E = None
        self.txt = txt

c = A("c")
g = B("g")
m = C("m")
n = D("n")
e = E("e")
b = F("b")
h = G("h")
d = G("d")

c.q = e
c.t = e
c.s = g
c.u = g
c.r = n
c.o = d
g.y = h
g.q = b
g.r = n
m.u = h
m.o = h
m.p = b
m.z = b
m.s = e
m.x = e
m.q = g
n.r = d
e.z = m
e.y = n
e.p = g
b.s = d
b.v = c
h.z = c
h.o = n
h.w = e
d.z = c
d.o = n
d.w = e
assert m.q.r.r.o.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: B = None
        self.t: E = None
        self.r: D = None
        self.o: G = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.q: F = None
        self.r: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: D = None
        self.w: E = None
        self.txt = txt

c = A("c")
g = B("g")
m = C("m")
n = D("n")
e = E("e")
b = F("b")
h = G("h")
d = G("d")

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