class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: F = None
        self.t: G = None
        self.p: B = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: G = None
        self.z: D = None
        self.w: B = None
        self.q: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.u: F = None
        self.txt = txt

l = A("l")
j = B("j")
a = C("a")
b = D("b")
d = E("d")
k = F("k")
f = G("f")
h = D("h")
g = E("g")

l.u = f
j.r = a
j.t = a
j.p = k
j.y = l
a.z = k
a.y = k
a.t = f
a.s = f
a.p = j
b.o = j
b.w = j
b.s = f
b.z = h
b.q = d
d.t = g
k.p = h
k.v = l
k.u = j
f.r = d
f.u = k
h.o = j
h.w = j
h.s = f
h.z = b
h.q = g
g.t = d
assert f.r.t.t.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: F = None
        self.t: G = None
        self.p: B = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: G = None
        self.z: D = None
        self.w: B = None
        self.q: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.u: F = None
        self.txt = txt

l = A("l")
j = B("j")
a = C("a")
b = D("b")
d = E("d")
k = F("k")
f = G("f")
h = D("h")
g = E("g")

l.u = f
j.r = a
j.t = a
j.p = k
j.y = l
a.z = k
a.y = k
a.t = f
a.s = f
a.p = j
b.o = j
b.w = j
b.s = f
b.z = h
b.q = d
d.t = g
k.p = h
k.v = l
k.u = j
f.r = d
f.u = k
h.o = j
h.w = j
h.s = f
h.z = b
h.q = g
g.t = d
assert f.r.t.t.t.t.t.t.t.t.txt == "d"