class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.z: D = 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.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: C = None
        self.q: E = None
        self.txt = txt

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

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

a = A("a")
l = B("l")
n = C("n")
k = D("k")
m = E("m")
c = F("c")
f = E("f")
i = B("i")

a.u = c
a.z = k
l.t = c
n.q = a
k.p = m
k.y = n
k.q = f
m.x = f
m.q = c
m.t = c
m.z = k
c.p = n
f.x = m
f.q = c
f.t = c
f.z = k
i.t = c
assert f.x.z.p.q.p.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.z: D = 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.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: C = None
        self.q: E = None
        self.txt = txt

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

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

a = A("a")
l = B("l")
n = C("n")
k = D("k")
m = E("m")
c = F("c")
f = E("f")
i = B("i")

a.u = c
a.z = k
l.t = c
n.q = a
k.p = m
k.y = n
k.q = f
m.x = f
m.q = c
m.t = c
m.z = k
c.p = n
f.x = m
f.q = c
f.t = c
f.z = k
i.t = c
assert f.x.z.p.q.p.q.z.txt == "k"