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

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

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

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

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

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

m = A("m")
j = B("j")
k = C("k")
g = D("g")
h = E("h")
c = F("c")
a = A("a")
l = D("l")

m.u = k
j.v = h
k.z = m
g.w = l
h.t = l
h.w = l
h.y = m
h.p = m
h.z = a
c.y = m
a.u = k
l.w = g
assert k.z.u.z.u.z.u.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

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

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

m = A("m")
j = B("j")
k = C("k")
g = D("g")
h = E("h")
c = F("c")
a = A("a")
l = D("l")

m.u = k
j.v = h
k.z = m
g.w = l
h.t = l
h.w = l
h.y = m
h.p = m
h.z = a
c.y = m
a.u = k
l.w = g
assert k.z.u.z.u.z.u.z.u.txt == "k"