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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.o: A = None
        self.q: C = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.o: A = None
        self.q: C = None
        self.w: C = None
        self.txt = txt

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

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

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