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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: E = None
        self.v: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.p: F = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: E = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: E = None
        self.v: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.p: F = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: E = None
        self.txt = txt

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

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

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

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

b.q = m
d.y = c
d.r = l
d.v = l
h.y = a
h.s = a
h.p = m
c.o = m
c.u = l
l.s = d
l.u = d
l.q = f
l.o = b
l.v = c
m.z = h
a.w = m
a.p = m
a.r = m
a.y = m
a.v = m
f.q = m
e.o = m
e.u = l
n.o = m
n.u = l
assert m.z.p.z.p.z.s.y.z.p.txt == "m"