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

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

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

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

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

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

f = A("f")
c = B("c")
h = C("h")
i = D("i")
l = E("l")
k = F("k")

f.q = i
f.u = l
c.p = f
h.y = f
h.o = f
h.u = c
h.t = c
h.r = k
i.o = l
i.x = l
i.w = f
i.u = f
l.o = i
l.u = f
l.v = h
k.w = c
k.p = f
assert f.q.w.u.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: E = None
        self.txt = txt

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

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

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

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

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

f = A("f")
c = B("c")
h = C("h")
i = D("i")
l = E("l")
k = F("k")

f.q = i
f.u = l
c.p = f
h.y = f
h.o = f
h.u = c
h.t = c
h.r = k
i.o = l
i.x = l
i.w = f
i.u = f
l.o = i
l.u = f
l.v = h
k.w = c
k.p = f
assert f.q.w.u.o.u.txt == "f"