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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: G = None
        self.x: E = None
        self.o: A = None
        self.r: B = None
        self.q: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: G = None
        self.x: E = None
        self.o: A = None
        self.r: B = None
        self.q: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: D = None
        self.txt = txt

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

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

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

j.r = a
j.s = d
j.w = d
j.x = k
j.t = k
j.z = m
d.z = k
d.y = m
k.t = m
k.z = g
k.y = a
k.o = j
b.w = m
b.x = m
b.z = a
b.q = a
b.o = j
b.r = d
m.q = b
m.o = b
g.r = b
a.r = j
assert b.o.r.r.z.o.txt == "b"