class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: C = None
        self.z: D = None
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: G = None
        self.t: D = None
        self.z: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: A = None
        self.z: E = None
        self.q: E = None
        self.r: C = None
        self.y: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: G = None
        self.t: D = None
        self.z: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: A = None
        self.z: E = None
        self.q: E = None
        self.r: C = None
        self.y: A = None
        self.txt = txt

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

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