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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

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

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

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

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