class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: E = None
        self.p: F = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: A = None
        self.z: C = None
        self.t: F = None
        self.r: A = None
        self.v: F = None
        self.q: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: E = None
        self.u: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.r: F = None
        self.x: A = None
        self.p: D = None
        self.u: G = None
        self.z: F = None
        self.o: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: E = None
        self.t: E = None
        self.x: C = None
        self.w: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: A = None
        self.z: C = None
        self.t: F = None
        self.r: A = None
        self.v: F = None
        self.q: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: E = None
        self.u: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.r: F = None
        self.x: A = None
        self.p: D = None
        self.u: G = None
        self.z: F = None
        self.o: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: E = None
        self.t: E = None
        self.x: C = None
        self.w: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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