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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: A = None
        self.w: A = None
        self.y: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: G = None
        self.s: B = None
        self.v: B = None
        self.y: D = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: D = None
        self.y: C = None
        self.x: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: A = None
        self.r: C = None
        self.s: D = None
        self.t: D = None
        self.txt = txt

g = A("g")
b = B("b")
d = C("d")
k = D("k")
n = E("n")
i = F("i")
m = G("m")
c = D("c")

g.r = m
g.q = m
b.q = d
b.r = g
b.w = g
b.y = m
d.p = i
k.z = c
k.o = g
n.t = c
n.p = c
n.z = m
n.s = b
n.v = b
n.y = k
i.v = n
i.u = k
i.y = d
i.x = d
m.o = n
m.w = g
m.r = d
m.s = c
m.t = k
c.z = k
c.o = g
assert g.q.o.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: A = None
        self.w: A = None
        self.y: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: G = None
        self.s: B = None
        self.v: B = None
        self.y: D = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: D = None
        self.y: C = None
        self.x: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: A = None
        self.r: C = None
        self.s: D = None
        self.t: D = None
        self.txt = txt

g = A("g")
b = B("b")
d = C("d")
k = D("k")
n = E("n")
i = F("i")
m = G("m")
c = D("c")

g.r = m
g.q = m
b.q = d
b.r = g
b.w = g
b.y = m
d.p = i
k.z = c
k.o = g
n.t = c
n.p = c
n.z = m
n.s = b
n.v = b
n.y = k
i.v = n
i.u = k
i.y = d
i.x = d
m.o = n
m.w = g
m.r = d
m.s = c
m.t = k
c.z = k
c.o = g
assert g.q.o.v.r.txt == "g"