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

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

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

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

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

b = A("b")
j = B("j")
k = C("k")
m = D("m")
l = E("l")
g = B("g")

b.v = k
j.o = l
j.w = l
k.t = j
m.v = l
l.p = m
g.o = l
g.w = l
assert g.w.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

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

b = A("b")
j = B("j")
k = C("k")
m = D("m")
l = E("l")
g = B("g")

b.v = k
j.o = l
j.w = l
k.t = j
m.v = l
l.p = m
g.o = l
g.w = l
assert g.w.p.v.txt == "l"