class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: D = None
        self.z: C = None
        self.u: E = None
        self.y: B = None
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: D = None
        self.r: C = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: D = None
        self.r: C = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

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