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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: B = None
        self.x: B = None
        self.z: B = None
        self.o: A = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.w: F = None
        self.z: A = None
        self.p: E = None
        self.v: F = None
        self.q: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: B = None
        self.s: B = None
        self.txt = txt

h = A("h")
n = B("n")
l = C("l")
g = D("g")
k = E("k")
e = F("e")

h.q = e
n.s = e
n.r = k
n.o = k
n.q = k
n.v = g
l.s = h
l.o = h
l.t = n
l.x = n
l.z = n
l.p = g
g.r = e
g.w = e
g.v = e
g.z = h
g.p = k
g.q = n
k.p = e
k.q = l
k.v = n
e.o = g
e.v = n
e.s = n
assert k.p.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: B = None
        self.x: B = None
        self.z: B = None
        self.o: A = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.w: F = None
        self.z: A = None
        self.p: E = None
        self.v: F = None
        self.q: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: B = None
        self.s: B = None
        self.txt = txt

h = A("h")
n = B("n")
l = C("l")
g = D("g")
k = E("k")
e = F("e")

h.q = e
n.s = e
n.r = k
n.o = k
n.q = k
n.v = g
l.s = h
l.o = h
l.t = n
l.x = n
l.z = n
l.p = g
g.r = e
g.w = e
g.v = e
g.z = h
g.p = k
g.q = n
k.p = e
k.q = l
k.v = n
e.o = g
e.v = n
e.s = n
assert k.p.v.r.txt == "k"