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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: D = 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.r: F = None
        self.x: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.w: G = None
        self.v: D = None
        self.x: G = None
        self.z: C = None
        self.s: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: F = None
        self.x: D = None
        self.txt = txt

f = A("f")
l = B("l")
n = C("n")
b = D("b")
m = E("m")
d = F("d")
e = G("e")

f.u = e
l.t = m
l.z = b
n.z = f
b.r = d
b.x = m
m.z = f
d.r = e
d.w = e
d.x = e
d.v = b
d.z = n
d.s = f
e.r = n
e.u = d
e.x = b
assert l.t.z.u.x.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: D = 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.r: F = None
        self.x: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.w: G = None
        self.v: D = None
        self.x: G = None
        self.z: C = None
        self.s: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: F = None
        self.x: D = None
        self.txt = txt

f = A("f")
l = B("l")
n = C("n")
b = D("b")
m = E("m")
d = F("d")
e = G("e")

f.u = e
l.t = m
l.z = b
n.z = f
b.r = d
b.x = m
m.z = f
d.r = e
d.w = e
d.x = e
d.v = b
d.z = n
d.s = f
e.r = n
e.u = d
e.x = b
assert l.t.z.u.x.x.z.txt == "f"