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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: B = None
        self.p: D = None
        self.x: A = None
        self.u: B = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

b = A("b")
k = B("k")
e = C("e")
f = D("f")
c = E("c")
n = F("n")
i = G("i")

b.u = n
k.w = e
k.r = b
k.z = b
k.v = n
k.x = c
e.p = n
f.p = e
c.t = f
c.v = f
c.y = k
n.y = k
n.t = k
n.u = k
n.p = f
n.o = f
n.w = f
n.x = b
i.p = b
assert f.p.p.x.u.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: B = None
        self.p: D = None
        self.x: A = None
        self.u: B = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

b = A("b")
k = B("k")
e = C("e")
f = D("f")
c = E("c")
n = F("n")
i = G("i")

b.u = n
k.w = e
k.r = b
k.z = b
k.v = n
k.x = c
e.p = n
f.p = e
c.t = f
c.v = f
c.y = k
n.y = k
n.t = k
n.u = k
n.p = f
n.o = f
n.w = f
n.x = b
i.p = b
assert f.p.p.x.u.y.z.txt == "b"