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

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

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

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

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

i.u = j
i.x = m
g.v = e
g.r = e
g.s = i
j.z = i
j.o = m
m.y = j
m.t = n
m.u = i
m.o = b
f.y = e
f.t = g
f.u = i
f.o = b
e.z = i
e.o = f
b.v = e
b.r = j
b.s = i
n.v = j
n.r = e
n.s = i
assert i.x.u.u.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: D = None
        self.txt = txt

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

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

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

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

i.u = j
i.x = m
g.v = e
g.r = e
g.s = i
j.z = i
j.o = m
m.y = j
m.t = n
m.u = i
m.o = b
f.y = e
f.t = g
f.u = i
f.o = b
e.z = i
e.o = f
b.v = e
b.r = j
b.s = i
n.v = j
n.r = e
n.s = i
assert i.x.u.u.o.u.txt == "i"