class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: E = None
        self.p: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: F = None
        self.s: C = None
        self.x: A = None
        self.p: F = None
        self.txt = txt

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

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

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

d.z = n
d.v = n
d.p = k
b.s = n
i.w = l
i.t = l
g.s = n
n.o = d
n.x = d
n.z = l
n.p = l
n.s = i
l.o = n
l.z = d
k.v = l
assert k.v.z.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: E = None
        self.p: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: F = None
        self.s: C = None
        self.x: A = None
        self.p: F = None
        self.txt = txt

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

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

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

d.z = n
d.v = n
d.p = k
b.s = n
i.w = l
i.t = l
g.s = n
n.o = d
n.x = d
n.z = l
n.p = l
n.s = i
l.o = n
l.z = d
k.v = l
assert k.v.z.z.s.txt == "i"