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

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.t: G = None
        self.z: G = None
        self.s: G = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.t: G = None
        self.z: G = None
        self.s: G = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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