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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: F = None
        self.p: E = None
        self.s: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: F = None
        self.x: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: F = None
        self.p: E = None
        self.s: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: F = None
        self.x: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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