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

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

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

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

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

f.t = i
f.z = j
f.x = c
d.t = h
d.p = j
d.r = e
d.o = c
k.s = d
k.y = e
k.x = g
k.v = j
a.o = h
a.s = f
a.x = g
j.t = a
j.p = d
j.r = k
j.o = c
h.o = a
h.s = c
h.x = i
g.t = a
g.p = j
g.r = e
g.o = f
e.s = g
e.x = g
e.y = k
e.v = i
c.t = g
c.z = i
c.x = f
i.t = h
i.p = d
i.r = e
i.o = c
assert d.t.x.r.y.x.o.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: B = None
        self.x: A = None
        self.txt = txt

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

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

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

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

f.t = i
f.z = j
f.x = c
d.t = h
d.p = j
d.r = e
d.o = c
k.s = d
k.y = e
k.x = g
k.v = j
a.o = h
a.s = f
a.x = g
j.t = a
j.p = d
j.r = k
j.o = c
h.o = a
h.s = c
h.x = i
g.t = a
g.p = j
g.r = e
g.o = f
e.s = g
e.x = g
e.y = k
e.v = i
c.t = g
c.z = i
c.x = f
i.t = h
i.p = d
i.r = e
i.o = c
assert d.t.x.r.y.x.o.t.o.txt == "c"