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

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: A = None
        self.r: B = None
        self.y: C = None
        self.txt = txt

h = A("h")
e = B("e")
m = C("m")
l = D("l")
c = A("c")
a = C("a")
d = B("d")

h.u = c
h.o = l
h.p = a
e.y = l
m.v = h
m.o = c
l.w = e
l.r = e
l.q = h
l.y = m
c.u = h
c.o = l
c.p = a
a.v = h
a.o = c
d.y = l
assert e.y.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: D = None
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: A = None
        self.r: B = None
        self.y: C = None
        self.txt = txt

h = A("h")
e = B("e")
m = C("m")
l = D("l")
c = A("c")
a = C("a")
d = B("d")

h.u = c
h.o = l
h.p = a
e.y = l
m.v = h
m.o = c
l.w = e
l.r = e
l.q = h
l.y = m
c.u = h
c.o = l
c.p = a
a.v = h
a.o = c
d.y = l
assert e.y.q.u.txt == "c"