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

class B:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: D = None
        self.o: A = None
        self.x: F = None
        self.w: A = None
        self.r: D = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: B = None
        self.u: E = None
        self.v: G = None
        self.p: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: G = None
        self.p: F = None
        self.s: A = None
        self.q: F = None
        self.v: A = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: D = None
        self.o: A = None
        self.x: F = None
        self.w: A = None
        self.r: D = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: B = None
        self.u: E = None
        self.v: G = None
        self.p: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: G = None
        self.p: F = None
        self.s: A = None
        self.q: F = None
        self.v: A = None
        self.txt = txt

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

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

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

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