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

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

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

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

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

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

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

m.o = g
d.v = f
d.u = b
d.s = g
d.z = e
d.o = e
d.t = l
h.y = b
g.o = d
g.t = d
g.x = b
g.s = h
b.s = d
e.q = d
e.v = g
e.w = b
f.y = b
l.o = g
assert h.y.s.t.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

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

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

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