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

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

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

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

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

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

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

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

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

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

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

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

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

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

a.z = e
h.t = f
h.x = f
e.t = m
e.u = a
e.r = l
f.p = n
f.y = n
f.q = a
f.w = a
f.t = k
f.s = l
k.y = a
m.s = l
l.s = m
b.y = n
n.z = e
assert k.y.z.u.z.r.txt == "l"