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

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: C = None
        self.s: B = None
        self.z: C = None
        self.x: C = None
        self.txt = txt

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

b = A("b")
d = B("d")
i = C("i")
m = D("m")
g = E("g")
e = F("e")

b.v = m
b.w = m
b.x = d
b.s = g
d.v = i
d.s = g
i.t = e
m.y = d
g.p = i
g.u = i
g.z = i
g.x = i
g.s = d
e.r = b
assert b.w.y.v.t.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: B = None
        self.s: E = None
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: C = None
        self.s: B = None
        self.z: C = None
        self.x: C = None
        self.txt = txt

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

b = A("b")
d = B("d")
i = C("i")
m = D("m")
g = E("g")
e = F("e")

b.v = m
b.w = m
b.x = d
b.s = g
d.v = i
d.s = g
i.t = e
m.y = d
g.p = i
g.u = i
g.z = i
g.x = i
g.s = d
e.r = b
assert b.w.y.v.t.r.w.txt == "m"