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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: B = None
        self.w: A = None
        self.z: D = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: E = None
        self.u: E = None
        self.o: B = None
        self.p: B = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: B = None
        self.w: A = None
        self.z: D = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: E = None
        self.u: E = None
        self.o: B = None
        self.p: B = None
        self.q: D = None
        self.txt = txt

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

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