class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: C = None
        self.s: B = None
        self.t: A = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
e = C("e")
i = D("i")
f = A("f")
b = D("b")
l = B("l")
g = B("g")
d = C("d")

c.u = g
c.s = g
c.z = e
c.t = f
j.x = c
e.q = b
e.z = j
e.x = j
i.o = b
i.s = d
i.t = e
f.u = g
f.s = g
f.z = e
f.t = c
b.o = i
b.s = e
b.t = e
l.x = c
g.x = f
d.q = i
d.z = l
d.x = j
assert i.s.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: C = None
        self.s: B = None
        self.t: A = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
e = C("e")
i = D("i")
f = A("f")
b = D("b")
l = B("l")
g = B("g")
d = C("d")

c.u = g
c.s = g
c.z = e
c.t = f
j.x = c
e.q = b
e.z = j
e.x = j
i.o = b
i.s = d
i.t = e
f.u = g
f.s = g
f.z = e
f.t = c
b.o = i
b.s = e
b.t = e
l.x = c
g.x = f
d.q = i
d.z = l
d.x = j
assert i.s.x.x.txt == "c"