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

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

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

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

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

n = A("n")
k = B("k")
b = C("b")
l = D("l")
f = E("f")
i = A("i")
g = D("g")
e = B("e")

n.p = k
n.r = l
n.w = b
k.p = l
b.v = l
b.r = l
b.w = e
b.u = k
l.p = f
f.t = b
f.v = b
i.p = e
i.r = g
i.w = b
g.p = f
e.p = l
assert i.r.p.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

n = A("n")
k = B("k")
b = C("b")
l = D("l")
f = E("f")
i = A("i")
g = D("g")
e = B("e")

n.p = k
n.r = l
n.w = b
k.p = l
b.v = l
b.r = l
b.w = e
b.u = k
l.p = f
f.t = b
f.v = b
i.p = e
i.r = g
i.w = b
g.p = f
e.p = l
assert i.r.p.t.v.txt == "l"