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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: A = None
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: A = None
        self.t: A = None
        self.v: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: A = None
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: A = None
        self.t: A = None
        self.v: B = None
        self.txt = txt

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

h.q = d
h.z = d
h.r = c
h.p = c
h.s = f
d.w = m
d.s = h
d.y = f
c.w = d
c.v = l
m.w = h
m.t = h
m.x = f
m.z = l
m.u = d
m.v = c
l.u = m
f.u = c
f.y = d
f.z = l
f.o = k
f.s = m
k.s = d
k.v = d
k.o = h
k.t = h
assert k.o.p.v.u.txt == "m"