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

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

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

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

g = A("g")
j = B("j")
a = C("a")
c = D("c")
n = D("n")
l = B("l")

g.q = a
g.z = l
g.y = c
j.q = g
j.u = g
j.y = g
j.p = a
a.w = g
a.y = n
a.q = c
a.o = j
c.y = a
c.w = l
c.x = j
c.p = j
n.y = a
n.w = j
n.x = l
n.p = l
l.q = g
l.u = g
l.y = g
l.p = a
assert n.y.y.p.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.y: D = None
        self.txt = txt

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

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

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

g = A("g")
j = B("j")
a = C("a")
c = D("c")
n = D("n")
l = B("l")

g.q = a
g.z = l
g.y = c
j.q = g
j.u = g
j.y = g
j.p = a
a.w = g
a.y = n
a.q = c
a.o = j
c.y = a
c.w = l
c.x = j
c.p = j
n.y = a
n.w = j
n.x = l
n.p = l
l.q = g
l.u = g
l.y = g
l.p = a
assert n.y.y.p.y.y.txt == "c"