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

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

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

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

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

k = A("k")
f = B("f")
g = C("g")
j = D("j")
m = E("m")
e = C("e")
n = E("n")
l = B("l")

k.p = j
k.s = e
f.w = e
f.t = e
f.q = l
g.u = e
g.w = e
g.t = e
g.y = f
j.x = k
m.v = e
m.o = g
m.u = l
e.u = g
e.w = g
e.t = g
e.y = l
n.v = e
n.o = e
n.u = f
l.w = e
l.t = g
l.q = f
assert k.s.t.y.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: C = None
        self.txt = txt

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

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

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

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

k = A("k")
f = B("f")
g = C("g")
j = D("j")
m = E("m")
e = C("e")
n = E("n")
l = B("l")

k.p = j
k.s = e
f.w = e
f.t = e
f.q = l
g.u = e
g.w = e
g.t = e
g.y = f
j.x = k
m.v = e
m.o = g
m.u = l
e.u = g
e.w = g
e.t = g
e.y = l
n.v = e
n.o = e
n.u = f
l.w = e
l.t = g
l.q = f
assert k.s.t.y.t.t.txt == "g"