class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: C = None
        self.v: D = None
        self.r: D = None
        self.o: G = None
        self.q: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: B = None
        self.o: D = None
        self.p: G = None
        self.y: A = None
        self.v: D = None
        self.t: G = None
        self.txt = txt

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

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

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

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

l = A("l")
h = B("h")
e = C("e")
i = D("i")
k = E("k")
b = F("b")
d = G("d")
f = E("f")

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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: B = None
        self.o: D = None
        self.p: G = None
        self.y: A = None
        self.v: D = None
        self.t: G = None
        self.txt = txt

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

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

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

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

l = A("l")
h = B("h")
e = C("e")
i = D("i")
k = E("k")
b = F("b")
d = G("d")
f = E("f")

l.y = i
l.v = i
l.r = i
l.q = i
l.t = e
l.o = d
h.r = i
e.r = l
e.y = l
e.w = h
e.o = i
e.v = i
e.p = d
e.t = d
i.t = e
k.t = e
k.y = e
k.p = f
b.v = i
b.o = e
d.s = i
d.u = i
d.p = h
f.t = e
f.y = e
f.p = k
assert f.t.r.o.u.t.w.txt == "h"