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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: D = None
        self.txt = txt

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

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

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