class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: B = None
        self.q: E = None
        self.o: G = None
        self.v: A = None
        self.z: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

a = A("a")
g = B("g")
k = C("k")
c = D("c")
f = E("f")
e = F("e")
m = G("m")
d = A("d")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

a = A("a")
g = B("g")
k = C("k")
c = D("c")
f = E("f")
e = F("e")
m = G("m")
d = A("d")

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