class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: E = None
        self.r: F = None
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

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

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

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

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

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