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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: F = None
        self.r: B = None
        self.q: B = None
        self.y: E = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
m = C("m")
e = D("e")
a = E("a")
f = F("f")
c = E("c")

k.q = c
n.p = c
n.w = a
n.s = e
m.y = k
m.o = e
m.u = a
e.u = n
e.r = n
e.q = n
e.v = f
e.y = c
a.q = c
a.z = f
f.z = e
f.s = c
f.x = n
f.p = a
c.q = a
c.z = f
assert e.y.z.x.s.v.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: F = None
        self.r: B = None
        self.q: B = None
        self.y: E = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
m = C("m")
e = D("e")
a = E("a")
f = F("f")
c = E("c")

k.q = c
n.p = c
n.w = a
n.s = e
m.y = k
m.o = e
m.u = a
e.u = n
e.r = n
e.q = n
e.v = f
e.y = c
a.q = c
a.z = f
f.z = e
f.s = c
f.x = n
f.p = a
c.q = a
c.z = f
assert e.y.z.x.s.v.x.p.txt == "c"