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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: E = None
        self.s: A = None
        self.v: A = None
        self.p: E = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: B = None
        self.r: F = None
        self.txt = txt

j = A("j")
i = B("i")
m = C("m")
g = D("g")
e = E("e")
n = F("n")
f = F("f")
a = C("a")

j.t = i
i.u = e
i.x = g
m.r = g
m.y = a
g.w = j
g.s = j
g.v = j
g.x = e
g.p = e
g.r = a
e.q = a
n.w = i
n.y = i
n.r = f
f.w = i
f.y = i
f.r = n
a.r = g
a.y = m
assert f.y.x.p.q.r.r.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: E = None
        self.s: A = None
        self.v: A = None
        self.p: E = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: B = None
        self.r: F = None
        self.txt = txt

j = A("j")
i = B("i")
m = C("m")
g = D("g")
e = E("e")
n = F("n")
f = F("f")
a = C("a")

j.t = i
i.u = e
i.x = g
m.r = g
m.y = a
g.w = j
g.s = j
g.v = j
g.x = e
g.p = e
g.r = a
e.q = a
n.w = i
n.y = i
n.r = f
f.w = i
f.y = i
f.r = n
a.r = g
a.y = m
assert f.y.x.p.q.r.r.y.y.txt == "a"