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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: D = None
        self.y: D = None
        self.q: F = None
        self.txt = txt

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

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

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

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

h = A("h")
n = B("n")
j = C("j")
e = D("e")
k = E("k")
a = F("a")

h.x = j
h.v = j
h.p = n
n.v = j
n.w = e
n.y = e
n.q = a
j.t = k
j.o = k
j.z = e
j.q = a
e.o = a
e.v = a
k.x = j
k.w = n
a.x = j
assert k.x.q.x.o.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: D = None
        self.y: D = None
        self.q: F = None
        self.txt = txt

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

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

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

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

h = A("h")
n = B("n")
j = C("j")
e = D("e")
k = E("k")
a = F("a")

h.x = j
h.v = j
h.p = n
n.v = j
n.w = e
n.y = e
n.q = a
j.t = k
j.o = k
j.z = e
j.q = a
e.o = a
e.v = a
k.x = j
k.w = n
a.x = j
assert k.x.q.x.o.x.q.txt == "a"