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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: F = None
        self.q: C = None
        self.t: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.p: E = None
        self.w: A = None
        self.v: D = None
        self.r: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: F = None
        self.q: C = None
        self.t: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.p: E = None
        self.w: A = None
        self.v: D = None
        self.r: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: D = None
        self.txt = txt

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

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