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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: 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.u: F = None
        self.t: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: D = None
        self.u: E = None
        self.x: E = None
        self.q: D = None
        self.y: A = None
        self.txt = txt

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

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

a.x = i
e.u = a
e.s = n
i.q = c
m.z = k
n.u = d
n.t = e
d.z = c
d.y = c
d.p = m
d.q = m
d.u = n
d.x = n
l.y = a
l.t = d
l.o = c
k.x = i
c.x = i
assert m.z.x.q.x.q.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: 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.u: F = None
        self.t: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: D = None
        self.u: E = None
        self.x: E = None
        self.q: D = None
        self.y: A = None
        self.txt = txt

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

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

a.x = i
e.u = a
e.s = n
i.q = c
m.z = k
n.u = d
n.t = e
d.z = c
d.y = c
d.p = m
d.q = m
d.u = n
d.x = n
l.y = a
l.t = d
l.o = c
k.x = i
c.x = i
assert m.z.x.q.x.q.x.q.txt == "c"