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

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

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

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

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

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

f = A("f")
d = B("d")
l = C("l")
e = D("e")
n = E("n")
c = F("c")
h = F("h")
a = B("a")

f.v = e
d.q = h
l.t = f
e.z = n
e.u = h
e.y = c
n.u = f
c.z = h
c.r = h
h.z = c
h.r = c
a.q = h
assert f.v.z.u.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

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

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

f = A("f")
d = B("d")
l = C("l")
e = D("e")
n = E("n")
c = F("c")
h = F("h")
a = B("a")

f.v = e
d.q = h
l.t = f
e.z = n
e.u = h
e.y = c
n.u = f
c.z = h
c.r = h
h.z = c
h.r = c
a.q = h
assert f.v.z.u.v.z.txt == "n"