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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: E = None
        self.w: A = None
        self.v: D = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: B = None
        self.txt = txt

g = A("g")
c = B("c")
m = C("m")
k = D("k")
d = E("d")
e = D("e")
f = A("f")
b = D("b")

g.z = f
c.r = m
m.v = b
m.o = b
m.y = k
m.r = c
k.u = c
k.q = c
k.y = d
k.w = f
k.v = b
d.x = k
d.s = c
e.u = c
e.q = c
e.y = d
e.w = g
e.v = k
f.z = g
b.u = c
b.q = c
b.y = d
b.w = g
b.v = k
assert b.w.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: E = None
        self.w: A = None
        self.v: D = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: B = None
        self.txt = txt

g = A("g")
c = B("c")
m = C("m")
k = D("k")
d = E("d")
e = D("e")
f = A("f")
b = D("b")

g.z = f
c.r = m
m.v = b
m.o = b
m.y = k
m.r = c
k.u = c
k.q = c
k.y = d
k.w = f
k.v = b
d.x = k
d.s = c
e.u = c
e.q = c
e.y = d
e.w = g
e.v = k
f.z = g
b.u = c
b.q = c
b.y = d
b.w = g
b.v = k
assert b.w.z.z.z.txt == "f"