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

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

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

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

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

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

a = A("a")
m = B("m")
c = C("c")
d = D("d")
k = E("k")
l = F("l")

a.y = m
a.w = d
m.r = k
m.v = c
c.x = a
c.y = m
c.z = k
c.w = k
d.r = a
k.q = m
k.r = d
k.t = l
k.s = l
k.y = a
l.z = a
l.p = m
l.y = c
assert k.y.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

a = A("a")
m = B("m")
c = C("c")
d = D("d")
k = E("k")
l = F("l")

a.y = m
a.w = d
m.r = k
m.v = c
c.x = a
c.y = m
c.z = k
c.w = k
d.r = a
k.q = m
k.r = d
k.t = l
k.s = l
k.y = a
l.z = a
l.p = m
l.y = c
assert k.y.y.v.txt == "c"