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

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

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

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: D = None
        self.z: E = None
        self.w: D = None
        self.p: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: D = None
        self.z: E = None
        self.w: D = None
        self.p: C = None
        self.txt = txt

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

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