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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: A = None
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: B = None
        self.p: D = None
        self.s: F = None
        self.w: F = None
        self.o: G = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: A = None
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: B = None
        self.p: D = None
        self.s: F = None
        self.w: F = None
        self.o: G = None
        self.txt = txt

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

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

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

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