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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: E = None
        self.w: B = None
        self.s: A = None
        self.r: C = None
        self.txt = txt

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

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

n = A("n")
h = B("h")
m = C("m")
k = D("k")
i = E("i")
d = F("d")

n.w = h
h.t = d
m.v = k
k.q = m
k.r = m
k.x = i
k.w = h
k.s = n
i.z = m
i.r = m
i.u = m
d.o = i
assert i.u.v.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: E = None
        self.w: B = None
        self.s: A = None
        self.r: C = None
        self.txt = txt

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

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

n = A("n")
h = B("h")
m = C("m")
k = D("k")
i = E("i")
d = F("d")

n.w = h
h.t = d
m.v = k
k.q = m
k.r = m
k.x = i
k.w = h
k.s = n
i.z = m
i.r = m
i.u = m
d.o = i
assert i.u.v.w.t.txt == "d"