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

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

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

class D:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: A = None
        self.r: E = None
        self.q: A = None
        self.txt = txt

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

f = A("f")
j = B("j")
k = C("k")
h = D("h")
a = E("a")
g = D("g")
i = B("i")
b = D("b")
n = A("n")
c = B("c")

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: A = None
        self.r: E = None
        self.q: A = None
        self.txt = txt

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

f = A("f")
j = B("j")
k = C("k")
h = D("h")
a = E("a")
g = D("g")
i = B("i")
b = D("b")
n = A("n")
c = B("c")

f.t = k
j.u = n
j.y = h
k.v = c
k.o = g
h.s = g
h.x = f
h.q = f
h.r = a
a.x = k
a.s = c
a.z = h
g.s = b
g.x = n
g.r = a
g.q = f
i.u = n
i.y = g
b.s = g
b.x = n
b.q = n
b.r = a
n.t = k
c.u = n
c.y = g
assert k.o.x.t.o.txt == "g"