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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: A = None
        self.o: A = None
        self.q: E = None
        self.txt = txt

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

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

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

k = A("k")
l = B("l")
i = C("i")
n = D("n")
d = E("d")
m = F("m")

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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: A = None
        self.o: A = None
        self.q: E = None
        self.txt = txt

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

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

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

k = A("k")
l = B("l")
i = C("i")
n = D("n")
d = E("d")
m = F("m")

k.r = n
k.t = n
l.x = m
l.v = m
l.u = m
l.r = k
l.w = n
l.y = n
i.z = d
i.q = d
i.w = k
i.o = k
n.y = l
n.p = i
n.t = i
n.r = k
n.s = m
d.v = k
m.p = l
m.r = i
m.v = d
assert d.v.r.p.z.txt == "d"