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

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

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

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

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

c = A("c")
l = B("l")
h = C("h")
b = D("b")
m = E("m")
f = B("f")
j = E("j")

c.r = b
c.w = j
c.o = h
l.r = f
h.v = f
h.r = c
h.s = l
b.r = l
b.q = l
b.x = j
b.w = j
m.v = c
m.y = c
m.u = b
f.r = l
j.v = c
j.y = c
j.u = b
assert c.r.q.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: E = None
        self.o: C = None
        self.txt = txt

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

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

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

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

c = A("c")
l = B("l")
h = C("h")
b = D("b")
m = E("m")
f = B("f")
j = E("j")

c.r = b
c.w = j
c.o = h
l.r = f
h.v = f
h.r = c
h.s = l
b.r = l
b.q = l
b.x = j
b.w = j
m.v = c
m.y = c
m.u = b
f.r = l
j.v = c
j.y = c
j.u = b
assert c.r.q.r.r.r.txt == "f"