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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

k.o = d
h.p = b
h.u = b
h.t = f
b.u = h
b.p = m
b.o = d
f.p = m
f.s = k
e.s = f
e.v = f
e.o = f
e.y = k
d.z = m
d.u = e
m.z = d
m.s = f
m.y = f
m.p = e
m.w = b
m.q = h
assert m.s.p.z.z.p.y.txt == "k"