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

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

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

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

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

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

n = A("n")
e = B("e")
g = C("g")
f = D("f")
d = E("d")
i = F("i")
k = B("k")

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

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

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

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

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

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

n = A("n")
e = B("e")
g = C("g")
f = D("f")
d = E("d")
i = F("i")
k = B("k")

n.w = i
n.u = g
e.o = g
e.z = f
e.v = f
g.o = d
f.x = n
d.x = k
d.z = k
d.t = g
i.y = e
i.u = n
k.o = g
k.z = f
k.v = f
assert i.y.o.o.z.o.o.txt == "d"