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

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

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

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

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

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

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

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

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

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

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

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

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

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

a.y = g
a.x = b
a.p = b
a.z = f
a.q = e
k.v = g
k.p = a
g.u = m
g.q = f
g.x = b
f.w = g
f.o = k
f.z = e
f.x = m
m.r = f
m.t = i
m.p = d
d.y = m
d.p = f
d.z = e
b.y = g
b.x = a
b.p = a
b.z = f
b.q = e
i.u = m
i.q = f
i.x = a
e.y = m
e.p = f
e.z = d
assert k.p.x.z.w.u.txt == "m"