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

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

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

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

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

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

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

m.x = b
m.q = b
m.z = k
g.v = b
n.v = i
n.t = i
n.z = k
c.p = i
c.x = k
c.v = k
c.w = m
b.z = d
d.r = a
d.p = n
i.v = b
k.v = i
k.t = i
k.z = n
a.p = i
a.x = k
a.v = k
a.w = m
assert k.z.t.v.z.r.x.v.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.q: E = None
        self.z: C = None
        self.txt = txt

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

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

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

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

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

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

m.x = b
m.q = b
m.z = k
g.v = b
n.v = i
n.t = i
n.z = k
c.p = i
c.x = k
c.v = k
c.w = m
b.z = d
d.r = a
d.p = n
i.v = b
k.v = i
k.t = i
k.z = n
a.p = i
a.x = k
a.v = k
a.w = m
assert k.z.t.v.z.r.x.v.v.z.txt == "d"