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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: E = None
        self.x: A = None
        self.z: B = None
        self.p: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.r: E = None
        self.q: E = None
        self.p: F = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: E = None
        self.x: A = None
        self.z: B = None
        self.p: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.r: E = None
        self.q: E = None
        self.p: F = None
        self.txt = txt

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

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

e.x = f
e.q = m
a.u = g
a.q = m
h.r = e
h.p = e
h.w = k
h.x = m
h.z = a
g.y = f
g.t = k
g.p = h
b.o = f
b.p = f
b.r = k
b.q = k
f.y = h
f.t = e
f.p = m
f.s = k
k.o = f
k.p = f
k.r = b
k.q = b
m.x = f
m.q = e
assert g.y.y.z.q.x.p.txt == "m"