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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.z: C = None
        self.s: D = None
        self.p: G = None
        self.txt = txt

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

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

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

c.u = i
c.x = m
m.y = a
l.p = i
l.y = c
g.v = l
n.y = i
n.z = l
n.s = g
n.p = a
i.y = l
i.q = m
a.o = n
assert g.v.p.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.z: C = None
        self.s: D = None
        self.p: G = None
        self.txt = txt

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

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

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

c.u = i
c.x = m
m.y = a
l.p = i
l.y = c
g.v = l
n.y = i
n.z = l
n.s = g
n.p = a
i.y = l
i.q = m
a.o = n
assert g.v.p.q.y.txt == "a"