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

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: D = None
        self.p: F = None
        self.q: D = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: D = None
        self.p: F = None
        self.q: D = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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