class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: A = None
        self.t: C = None
        self.v: D = None
        self.x: A = None
        self.q: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: B = None
        self.s: B = None
        self.y: C = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
g = C("g")
d = D("d")
m = E("m")
b = F("b")
a = G("a")

e.t = b
e.p = j
j.y = d
j.v = d
j.r = e
j.x = e
j.t = g
j.q = g
g.q = b
g.x = e
d.z = e
m.q = d
m.z = j
m.s = j
m.y = g
b.z = a
b.o = a
a.z = g
a.u = g
a.x = g
a.p = m
assert d.z.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: A = None
        self.t: C = None
        self.v: D = None
        self.x: A = None
        self.q: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: B = None
        self.s: B = None
        self.y: C = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
g = C("g")
d = D("d")
m = E("m")
b = F("b")
a = G("a")

e.t = b
e.p = j
j.y = d
j.v = d
j.r = e
j.x = e
j.t = g
j.q = g
g.q = b
g.x = e
d.z = e
m.q = d
m.z = j
m.s = j
m.y = g
b.z = a
b.o = a
a.z = g
a.u = g
a.x = g
a.p = m
assert d.z.t.o.txt == "a"