class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: F = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: F = None
        self.z: B = None
        self.p: B = None
        self.t: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: C = None
        self.p: A = None
        self.v: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: F = None
        self.z: B = None
        self.p: B = None
        self.t: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: C = None
        self.p: A = None
        self.v: B = None
        self.txt = txt

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

i.p = d
i.t = d
i.r = m
f.p = l
f.x = d
f.o = m
m.w = f
m.z = f
m.p = f
m.o = d
m.t = l
g.q = m
l.u = m
d.x = i
d.p = i
d.y = m
d.v = f
assert d.p.p.y.t.txt == "l"