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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: E = None
        self.x: B = None
        self.t: B = None
        self.txt = txt

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

g = A("g")
h = B("h")
m = C("m")
j = D("j")
i = E("i")
b = C("b")
l = A("l")
f = C("f")

g.q = h
g.t = h
g.w = i
h.w = l
m.r = f
m.v = f
j.p = m
j.q = i
j.x = h
j.t = h
i.v = h
b.r = f
b.v = f
l.q = h
l.t = h
l.w = i
f.r = b
f.v = b
assert l.t.w.q.w.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: B = None
        self.w: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: E = None
        self.x: B = None
        self.t: B = None
        self.txt = txt

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

g = A("g")
h = B("h")
m = C("m")
j = D("j")
i = E("i")
b = C("b")
l = A("l")
f = C("f")

g.q = h
g.t = h
g.w = i
h.w = l
m.r = f
m.v = f
j.p = m
j.q = i
j.x = h
j.t = h
i.v = h
b.r = f
b.v = f
l.q = h
l.t = h
l.w = i
f.r = b
f.v = b
assert l.t.w.q.w.w.v.txt == "h"