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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: G = None
        self.x: D = None
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: G = None
        self.q: B = None
        self.u: D = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: G = None
        self.x: D = None
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: G = None
        self.q: B = None
        self.u: D = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: D = None
        self.txt = txt

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

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