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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

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

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

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

j = A("j")
k = B("k")
h = C("h")
l = D("l")
i = E("i")
n = F("n")

j.x = i
k.y = i
h.q = k
h.t = k
h.s = k
h.p = j
h.x = l
h.w = i
l.r = k
i.z = n
i.q = h
n.z = h
assert k.y.q.x.r.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

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

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

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

j = A("j")
k = B("k")
h = C("h")
l = D("l")
i = E("i")
n = F("n")

j.x = i
k.y = i
h.q = k
h.t = k
h.s = k
h.p = j
h.x = l
h.w = i
l.r = k
i.z = n
i.q = h
n.z = h
assert k.y.q.x.r.y.q.txt == "h"