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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: F = None
        self.r: C = None
        self.p: D = None
        self.v: A = None
        self.q: F = None
        self.s: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: E = None
        self.r: D = None
        self.o: B = None
        self.u: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: A = None
        self.w: D = None
        self.q: G = None
        self.s: E = None
        self.txt = txt

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

d = A("d")
c = B("c")
k = C("k")
g = D("g")
i = E("i")
a = F("a")
f = G("f")
n = C("n")

d.x = i
d.v = k
c.z = g
c.p = g
c.s = g
c.o = a
c.q = a
c.r = k
c.v = d
k.t = i
k.q = i
k.u = i
k.r = g
k.o = c
g.r = a
i.u = f
a.u = n
a.o = d
a.w = g
a.q = f
a.s = i
f.z = a
n.t = i
n.q = i
n.u = i
n.r = g
n.o = c
assert a.w.r.o.x.u.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: F = None
        self.r: C = None
        self.p: D = None
        self.v: A = None
        self.q: F = None
        self.s: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: E = None
        self.r: D = None
        self.o: B = None
        self.u: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: A = None
        self.w: D = None
        self.q: G = None
        self.s: E = None
        self.txt = txt

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

d = A("d")
c = B("c")
k = C("k")
g = D("g")
i = E("i")
a = F("a")
f = G("f")
n = C("n")

d.x = i
d.v = k
c.z = g
c.p = g
c.s = g
c.o = a
c.q = a
c.r = k
c.v = d
k.t = i
k.q = i
k.u = i
k.r = g
k.o = c
g.r = a
i.u = f
a.u = n
a.o = d
a.w = g
a.q = f
a.s = i
f.z = a
n.t = i
n.q = i
n.u = i
n.r = g
n.o = c
assert a.w.r.o.x.u.z.s.txt == "i"