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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: A = None
        self.txt = txt

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

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

k.x = m
k.q = i
n.t = d
i.p = k
i.t = k
i.v = k
h.x = l
h.p = m
h.q = k
j.u = h
j.o = k
m.x = i
m.p = i
m.w = h
m.z = h
l.x = i
l.p = i
l.w = h
l.z = h
d.u = h
d.o = k
assert l.x.t.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: A = None
        self.txt = txt

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

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

k.x = m
k.q = i
n.t = d
i.p = k
i.t = k
i.v = k
h.x = l
h.p = m
h.q = k
j.u = h
j.o = k
m.x = i
m.p = i
m.w = h
m.z = h
l.x = i
l.p = i
l.w = h
l.z = h
d.u = h
d.o = k
assert l.x.t.q.v.txt == "k"