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

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: C = None
        self.v: G = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

g.v = j
g.z = i
g.y = b
d.u = b
d.v = b
d.p = c
d.o = i
c.s = m
m.t = c
m.o = j
m.r = g
i.z = j
i.o = g
i.x = b
j.x = b
b.s = d
b.q = d
b.x = g
b.t = c
b.p = i
assert c.s.r.v.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: E = None
        self.y: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: C = None
        self.v: G = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

g.v = j
g.z = i
g.y = b
d.u = b
d.v = b
d.p = c
d.o = i
c.s = m
m.t = c
m.o = j
m.r = g
i.z = j
i.o = g
i.x = b
j.x = b
b.s = d
b.q = d
b.x = g
b.t = c
b.p = i
assert c.s.r.v.x.q.txt == "d"