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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: C = None
        self.r: C = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: C = None
        self.r: C = None
        self.p: D = None
        self.txt = txt

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

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

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