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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: F = None
        self.z: B = None
        self.o: B = None
        self.y: F = None
        self.txt = txt

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

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

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

a = A("a")
f = B("f")
h = C("h")
l = D("l")
i = E("i")
d = F("d")

a.w = h
f.t = i
f.v = l
f.u = d
h.x = f
h.z = f
h.o = f
h.r = d
h.y = d
l.s = i
i.o = a
d.p = f
d.r = i
d.o = l
assert f.u.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: F = None
        self.z: B = None
        self.o: B = None
        self.y: F = None
        self.txt = txt

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

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

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

a = A("a")
f = B("f")
h = C("h")
l = D("l")
i = E("i")
d = F("d")

a.w = h
f.t = i
f.v = l
f.u = d
h.x = f
h.z = f
h.o = f
h.r = d
h.y = d
l.s = i
i.o = a
d.p = f
d.r = i
d.o = l
assert f.u.p.u.p.txt == "f"