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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: G = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: G = None
        self.y: F = None
        self.r: B = None
        self.txt = txt

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

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

d = A("d")
k = B("k")
e = C("e")
c = D("c")
h = E("h")
f = F("f")
i = G("i")

d.z = i
d.x = i
d.u = k
d.t = k
d.p = f
d.y = c
k.x = d
e.q = h
c.t = e
c.p = i
c.r = k
h.o = c
h.q = i
h.y = f
h.r = k
f.x = c
f.z = h
f.o = k
i.s = c
assert c.p.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: G = None
        self.x: G = None
        self.u: B = None
        self.t: B = None
        self.p: F = None
        self.y: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: G = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: G = None
        self.y: F = None
        self.r: B = None
        self.txt = txt

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

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

d = A("d")
k = B("k")
e = C("e")
c = D("c")
h = E("h")
f = F("f")
i = G("i")

d.z = i
d.x = i
d.u = k
d.t = k
d.p = f
d.y = c
k.x = d
e.q = h
c.t = e
c.p = i
c.r = k
h.o = c
h.q = i
h.y = f
h.r = k
f.x = c
f.z = h
f.o = k
i.s = c
assert c.p.s.r.txt == "k"