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

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: A = None
        self.p: B = None
        self.t: A = None
        self.txt = txt

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

g = A("g")
n = B("n")
i = C("i")
h = D("h")
l = A("l")

g.u = l
g.q = l
g.y = n
g.p = n
n.y = i
n.r = i
n.p = l
n.o = g
i.o = n
i.p = n
i.x = g
i.t = l
h.w = n
l.u = g
l.q = g
l.y = n
l.p = n
assert g.p.y.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: B = None
        self.q: A = None
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: A = None
        self.p: B = None
        self.t: A = None
        self.txt = txt

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

g = A("g")
n = B("n")
i = C("i")
h = D("h")
l = A("l")

g.u = l
g.q = l
g.y = n
g.p = n
n.y = i
n.r = i
n.p = l
n.o = g
i.o = n
i.p = n
i.x = g
i.t = l
h.w = n
l.u = g
l.q = g
l.y = n
l.p = n
assert g.p.y.t.y.txt == "n"