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

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

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

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

a = A("a")
m = B("m")
i = C("i")
g = D("g")
e = B("e")
c = B("c")
j = A("j")

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

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

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

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

a = A("a")
m = B("m")
i = C("i")
g = D("g")
e = B("e")
c = B("c")
j = A("j")

a.y = i
a.q = i
a.w = j
a.t = j
m.x = i
i.s = g
g.w = i
g.y = i
g.o = c
g.s = j
e.x = i
c.x = i
j.y = i
j.q = i
j.w = a
j.t = a
assert e.x.s.s.t.txt == "a"