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

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

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

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

l = A("l")
e = B("e")
a = C("a")
c = D("c")
i = A("i")
g = C("g")
j = C("j")
h = C("h")

l.w = i
e.v = i
e.w = i
e.t = i
a.s = e
a.o = c
a.r = g
c.p = e
c.q = i
i.w = l
g.s = e
g.o = c
g.r = a
j.s = e
j.o = c
j.r = h
h.s = e
h.o = c
h.r = g
assert e.v.w.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

l = A("l")
e = B("e")
a = C("a")
c = D("c")
i = A("i")
g = C("g")
j = C("j")
h = C("h")

l.w = i
e.v = i
e.w = i
e.t = i
a.s = e
a.o = c
a.r = g
c.p = e
c.q = i
i.w = l
g.s = e
g.o = c
g.r = a
j.s = e
j.o = c
j.r = h
h.s = e
h.o = c
h.r = g
assert e.v.w.w.w.w.w.w.txt == "i"