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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: D = None
        self.p: A = None
        self.v: E = None
        self.y: E = None
        self.o: A = None
        self.txt = txt

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

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

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

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

d = A("d")
i = B("i")
b = C("b")
c = D("c")
n = E("n")
l = F("l")
a = A("a")

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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: D = None
        self.p: A = None
        self.v: E = None
        self.y: E = None
        self.o: A = None
        self.txt = txt

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

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

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

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

d = A("d")
i = B("i")
b = C("b")
c = D("c")
n = E("n")
l = F("l")
a = A("a")

d.u = c
d.r = b
i.u = b
i.x = c
i.p = d
i.o = d
i.v = n
i.y = n
b.y = l
b.p = n
c.z = b
c.o = i
c.s = l
n.w = c
n.y = b
n.v = b
n.q = l
l.r = c
l.q = i
a.u = c
a.r = b
assert d.r.y.r.z.p.txt == "n"