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

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

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

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

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

f = A("f")
l = B("l")
j = C("j")
h = D("h")
a = E("a")
n = B("n")
i = C("i")

f.r = i
f.u = j
f.v = l
l.y = n
l.w = n
l.x = n
l.p = f
j.r = f
j.p = n
h.p = n
a.q = h
n.y = l
n.w = l
n.x = l
n.p = f
i.r = f
i.p = n
assert f.v.p.u.p.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: C = None
        self.v: B = None
        self.txt = txt

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

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

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

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

f = A("f")
l = B("l")
j = C("j")
h = D("h")
a = E("a")
n = B("n")
i = C("i")

f.r = i
f.u = j
f.v = l
l.y = n
l.w = n
l.x = n
l.p = f
j.r = f
j.p = n
h.p = n
a.q = h
n.y = l
n.w = l
n.x = l
n.p = f
i.r = f
i.p = n
assert f.v.p.u.p.p.u.txt == "j"