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

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

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

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

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

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

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

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

a.x = k
a.y = k
a.r = j
a.o = b
a.t = b
a.z = e
a.p = e
m.q = b
n.q = b
n.t = a
n.o = e
j.u = n
j.z = a
e.y = a
b.q = e
b.p = n
k.w = b
k.x = b
k.z = b
k.o = j
assert a.p.y.r.u.o.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: G = None
        self.y: G = None
        self.r: D = None
        self.o: F = None
        self.z: E = None
        self.t: F = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

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

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

a.x = k
a.y = k
a.r = j
a.o = b
a.t = b
a.z = e
a.p = e
m.q = b
n.q = b
n.t = a
n.o = e
j.u = n
j.z = a
e.y = a
b.q = e
b.p = n
k.w = b
k.x = b
k.z = b
k.o = j
assert a.p.y.r.u.o.y.t.txt == "b"