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

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

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

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

d = A("d")
g = B("g")
n = C("n")
b = D("b")
l = B("l")

d.o = b
d.u = n
g.y = n
g.z = l
n.v = l
n.w = l
n.s = b
n.z = b
b.y = d
b.s = g
b.v = l
b.t = n
l.y = n
l.z = g
assert b.t.v.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: C = None
        self.txt = txt

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

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

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

d = A("d")
g = B("g")
n = C("n")
b = D("b")
l = B("l")

d.o = b
d.u = n
g.y = n
g.z = l
n.v = l
n.w = l
n.s = b
n.z = b
b.y = d
b.s = g
b.v = l
b.t = n
l.y = n
l.z = g
assert b.t.v.z.y.txt == "n"