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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: F = None
        self.q: A = None
        self.w: A = None
        self.t: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: E = None
        self.txt = txt

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

f.u = h
f.t = d
f.s = d
f.w = d
f.x = n
f.p = i
d.t = h
d.o = h
i.x = d
i.z = h
i.q = f
i.w = f
i.t = n
n.s = i
n.o = d
n.y = h
e.u = f
h.v = i
h.q = e
assert i.q.u.v.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: B = None
        self.s: B = None
        self.w: B = None
        self.x: D = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: F = None
        self.q: A = None
        self.w: A = None
        self.t: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: E = None
        self.txt = txt

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

f.u = h
f.t = d
f.s = d
f.w = d
f.x = n
f.p = i
d.t = h
d.o = h
i.x = d
i.z = h
i.q = f
i.w = f
i.t = n
n.s = i
n.o = d
n.y = h
e.u = f
h.v = i
h.q = e
assert i.q.u.v.t.o.txt == "d"