class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.s: B = None
        self.t: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: B = None
        self.y: A = None
        self.r: F = None
        self.z: E = None
        self.txt = txt

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

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

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

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

m.v = n
m.t = n
m.s = b
g.w = l
g.r = n
l.x = n
l.s = g
l.y = m
l.r = a
l.z = k
n.r = a
k.s = e
k.o = n
k.y = n
k.p = l
a.w = m
a.v = l
e.w = l
e.r = n
b.w = l
b.r = n
assert m.s.r.r.v.s.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.s: B = None
        self.t: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: B = None
        self.y: A = None
        self.r: F = None
        self.z: E = None
        self.txt = txt

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

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

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

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

m.v = n
m.t = n
m.s = b
g.w = l
g.r = n
l.x = n
l.s = g
l.y = m
l.r = a
l.z = k
n.r = a
k.s = e
k.o = n
k.y = n
k.p = l
a.w = m
a.v = l
e.w = l
e.r = n
b.w = l
b.r = n
assert m.s.r.r.v.s.r.r.txt == "a"