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

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

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

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

c = A("c")
d = B("d")
h = C("h")
g = D("g")
n = D("n")
i = A("i")
e = B("e")

c.u = e
c.o = h
c.q = h
d.v = h
h.y = g
g.q = i
g.v = d
g.w = e
n.q = i
n.v = e
n.w = e
i.u = e
i.o = h
i.q = h
e.v = h
assert c.q.y.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.o: C = None
        self.q: C = None
        self.txt = txt

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

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

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

c = A("c")
d = B("d")
h = C("h")
g = D("g")
n = D("n")
i = A("i")
e = B("e")

c.u = e
c.o = h
c.q = h
d.v = h
h.y = g
g.q = i
g.v = d
g.w = e
n.q = i
n.v = e
n.w = e
i.u = e
i.o = h
i.q = h
e.v = h
assert c.q.y.q.u.txt == "e"