class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.v: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: B = None
        self.r: A = None
        self.txt = txt

f = A("f")
g = B("g")
j = C("j")
b = D("b")
a = E("a")
e = F("e")
h = C("h")
l = C("l")

f.w = e
f.v = a
g.q = b
j.y = f
b.u = f
b.r = e
b.o = j
b.s = a
a.r = b
e.x = f
e.r = f
e.z = g
h.y = f
l.y = f
assert l.y.v.r.o.y.w.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.v: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: B = None
        self.r: A = None
        self.txt = txt

f = A("f")
g = B("g")
j = C("j")
b = D("b")
a = E("a")
e = F("e")
h = C("h")
l = C("l")

f.w = e
f.v = a
g.q = b
j.y = f
b.u = f
b.r = e
b.o = j
b.s = a
a.r = b
e.x = f
e.r = f
e.z = g
h.y = f
l.y = f
assert l.y.v.r.o.y.w.r.w.txt == "e"