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

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

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

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

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

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

h.y = n
n.u = d
n.v = d
n.y = l
n.t = h
b.s = d
b.o = h
d.q = h
d.p = l
l.t = d
l.u = d
l.w = b
assert d.q.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

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

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

h.y = n
n.u = d
n.v = d
n.y = l
n.t = h
b.s = d
b.o = h
d.q = h
d.p = l
l.t = d
l.u = d
l.w = b
assert d.q.y.u.txt == "d"