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

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

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

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

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

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

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

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

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

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

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

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

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

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

h.q = f
h.p = m
n.r = m
n.w = f
n.z = c
m.r = k
m.p = k
m.s = k
m.q = h
m.w = c
c.s = f
c.o = f
c.u = f
c.w = f
c.z = n
c.t = m
f.s = m
k.v = c
k.u = c
k.t = n
k.r = f
assert k.r.s.w.t.r.u.txt == "c"