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

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

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

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

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

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

h.t = j
g.z = c
g.t = h
m.x = c
b.y = j
b.r = g
b.s = h
j.v = g
j.s = k
c.z = g
c.t = k
k.t = j
f.t = j
assert c.t.t.v.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

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

h.t = j
g.z = c
g.t = h
m.x = c
b.y = j
b.r = g
b.s = h
j.v = g
j.s = k
c.z = g
c.t = k
k.t = j
f.t = j
assert c.t.t.v.z.z.z.txt == "c"