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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.txt = txt

c = A("c")
k = B("k")
f = C("f")
j = D("j")
n = E("n")
h = A("h")
b = D("b")
g = E("g")
l = C("l")

c.w = k
k.y = g
k.p = g
f.u = l
j.q = h
j.r = c
j.w = k
j.o = b
n.r = c
n.u = c
h.w = k
b.q = h
b.r = c
b.w = k
b.o = j
g.r = c
g.u = c
l.u = f
assert l.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.txt = txt

c = A("c")
k = B("k")
f = C("f")
j = D("j")
n = E("n")
h = A("h")
b = D("b")
g = E("g")
l = C("l")

c.w = k
k.y = g
k.p = g
f.u = l
j.q = h
j.r = c
j.w = k
j.o = b
n.r = c
n.u = c
h.w = k
b.q = h
b.r = c
b.w = k
b.o = j
g.r = c
g.u = c
l.u = f
assert l.u.u.u.txt == "f"