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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: E = None
        self.u: C = None
        self.txt = txt

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

n.t = f
n.z = f
m.s = n
f.q = n
f.y = n
f.z = j
l.t = f
l.u = n
j.z = h
h.t = n
h.y = j
h.u = f
e.t = n
e.y = j
e.u = f
k.s = n
assert l.u.t.z.z.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: E = None
        self.u: C = None
        self.txt = txt

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

n.t = f
n.z = f
m.s = n
f.q = n
f.y = n
f.z = j
l.t = f
l.u = n
j.z = h
h.t = n
h.y = j
h.u = f
e.t = n
e.y = j
e.u = f
k.s = n
assert l.u.t.z.z.u.z.txt == "j"