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

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

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

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

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

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

f = A("f")
d = B("d")
l = C("l")
a = D("a")
j = E("j")
i = F("i")

f.u = i
d.u = a
d.y = l
l.z = j
a.y = f
a.t = f
a.x = j
a.u = j
a.r = i
j.r = f
j.u = i
j.v = a
j.z = a
i.y = a
i.t = f
assert l.z.z.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

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

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

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

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

f = A("f")
d = B("d")
l = C("l")
a = D("a")
j = E("j")
i = F("i")

f.u = i
d.u = a
d.y = l
l.z = j
a.y = f
a.t = f
a.x = j
a.u = j
a.r = i
j.r = f
j.u = i
j.v = a
j.z = a
i.y = a
i.t = f
assert l.z.z.r.y.txt == "a"