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

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

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

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

k = A("k")
m = B("m")
i = C("i")
b = D("b")
f = A("f")
g = C("g")
n = D("n")
e = C("e")

k.x = m
k.s = f
m.z = i
m.x = g
m.t = n
i.y = e
i.z = b
b.o = k
b.q = n
b.v = m
b.x = f
f.x = m
f.s = k
g.y = i
g.z = b
n.o = k
n.x = k
n.q = b
n.v = m
e.y = i
e.z = b
assert e.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: A = None
        self.txt = txt

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

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

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

k = A("k")
m = B("m")
i = C("i")
b = D("b")
f = A("f")
g = C("g")
n = D("n")
e = C("e")

k.x = m
k.s = f
m.z = i
m.x = g
m.t = n
i.y = e
i.z = b
b.o = k
b.q = n
b.v = m
b.x = f
f.x = m
f.s = k
g.y = i
g.z = b
n.o = k
n.x = k
n.q = b
n.v = m
e.y = i
e.z = b
assert e.y.y.y.txt == "i"