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

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: C = None
        self.q: A = None
        self.s: E = None
        self.txt = txt

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

f = A("f")
k = B("k")
n = C("n")
c = D("c")
j = E("j")
h = A("h")
i = D("i")

f.r = i
f.y = j
k.q = j
n.u = k
n.y = k
n.p = i
n.t = j
c.t = k
c.v = n
c.q = h
c.s = j
j.x = f
h.r = i
h.y = j
i.t = k
i.v = n
i.q = h
i.s = j
assert i.v.p.q.r.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: C = None
        self.q: A = None
        self.s: E = None
        self.txt = txt

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

f = A("f")
k = B("k")
n = C("n")
c = D("c")
j = E("j")
h = A("h")
i = D("i")

f.r = i
f.y = j
k.q = j
n.u = k
n.y = k
n.p = i
n.t = j
c.t = k
c.v = n
c.q = h
c.s = j
j.x = f
h.r = i
h.y = j
i.t = k
i.v = n
i.q = h
i.s = j
assert i.v.p.q.r.q.y.txt == "j"