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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: E = None
        self.t: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: F = None
        self.u: B = None
        self.t: B = None
        self.p: A = None
        self.w: A = None
        self.o: G = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: E = None
        self.t: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: F = None
        self.u: B = None
        self.t: B = None
        self.p: A = None
        self.w: A = None
        self.o: G = None
        self.txt = txt

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

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

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

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

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