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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: D = None
        self.w: E = None
        self.x: D = None
        self.txt = txt

f = A("f")
g = B("g")
m = C("m")
l = D("l")
b = E("b")
i = F("i")

f.p = g
g.t = b
g.q = m
m.o = i
m.s = l
m.w = g
m.u = f
m.p = b
l.p = b
l.o = b
b.s = l
b.t = g
b.o = i
i.z = l
i.q = l
i.x = l
i.w = b
assert i.w.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: D = None
        self.w: E = None
        self.x: D = None
        self.txt = txt

f = A("f")
g = B("g")
m = C("m")
l = D("l")
b = E("b")
i = F("i")

f.p = g
g.t = b
g.q = m
m.o = i
m.s = l
m.w = g
m.u = f
m.p = b
l.p = b
l.o = b
b.s = l
b.t = g
b.o = i
i.z = l
i.q = l
i.x = l
i.w = b
assert i.w.o.z.txt == "l"