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

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

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

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

k = A("k")
f = B("f")
m = C("m")
j = D("j")
g = A("g")
c = A("c")
h = B("h")
e = C("e")
b = B("b")

k.q = c
k.w = e
k.x = g
k.u = g
f.o = g
f.s = g
f.q = b
f.y = j
m.z = f
m.o = e
j.o = c
j.r = k
j.y = b
g.q = k
g.x = k
g.w = e
g.u = c
c.q = g
c.x = g
c.w = e
c.u = k
h.o = g
h.s = c
h.q = f
h.y = j
e.z = f
e.o = m
b.o = g
b.s = g
b.q = f
b.y = j
assert k.w.z.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: C = None
        self.x: A = None
        self.u: A = None
        self.txt = txt

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

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

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

k = A("k")
f = B("f")
m = C("m")
j = D("j")
g = A("g")
c = A("c")
h = B("h")
e = C("e")
b = B("b")

k.q = c
k.w = e
k.x = g
k.u = g
f.o = g
f.s = g
f.q = b
f.y = j
m.z = f
m.o = e
j.o = c
j.r = k
j.y = b
g.q = k
g.x = k
g.w = e
g.u = c
c.q = g
c.x = g
c.w = e
c.u = k
h.o = g
h.s = c
h.q = f
h.y = j
e.z = f
e.o = m
b.o = g
b.s = g
b.q = f
b.y = j
assert k.w.z.y.y.y.txt == "j"