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

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

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

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

k = A("k")
e = B("e")
c = C("c")
j = D("j")
f = A("f")
g = C("g")
a = C("a")

k.q = e
k.w = g
k.x = f
e.p = a
e.t = f
e.y = j
c.y = j
c.p = f
c.z = a
c.s = e
j.o = c
f.q = e
f.w = c
f.x = k
g.y = j
g.p = k
g.z = c
g.s = e
a.y = j
a.p = k
a.z = c
a.s = e
assert j.o.s.y.o.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: C = None
        self.x: A = None
        self.txt = txt

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

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

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

k = A("k")
e = B("e")
c = C("c")
j = D("j")
f = A("f")
g = C("g")
a = C("a")

k.q = e
k.w = g
k.x = f
e.p = a
e.t = f
e.y = j
c.y = j
c.p = f
c.z = a
c.s = e
j.o = c
f.q = e
f.w = c
f.x = k
g.y = j
g.p = k
g.z = c
g.s = e
a.y = j
a.p = k
a.z = c
a.s = e
assert j.o.s.y.o.z.z.txt == "c"