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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

m = A("m")
b = B("b")
d = C("d")
e = D("e")
k = E("k")
h = F("h")

m.y = d
m.p = k
m.v = h
m.x = h
m.r = b
m.w = b
b.s = h
d.z = h
d.w = b
d.v = k
d.r = m
d.p = m
e.p = b
e.x = b
e.r = b
e.v = k
k.t = e
h.w = d
h.v = d
h.x = e
assert b.s.x.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: E = None
        self.v: F = None
        self.r: B = None
        self.w: B = None
        self.x: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

m = A("m")
b = B("b")
d = C("d")
e = D("e")
k = E("k")
h = F("h")

m.y = d
m.p = k
m.v = h
m.x = h
m.r = b
m.w = b
b.s = h
d.z = h
d.w = b
d.v = k
d.r = m
d.p = m
e.p = b
e.x = b
e.r = b
e.v = k
k.t = e
h.w = d
h.v = d
h.x = e
assert b.s.x.p.s.txt == "h"