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

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

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.p: A = None
        self.x: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: C = None
        self.w: C = None
        self.s: F = None
        self.txt = txt

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

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

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

k.w = g
h.r = l
g.v = e
g.x = e
g.p = k
f.q = g
f.x = g
f.w = g
f.s = l
b.w = l
l.t = g
l.v = b
e.t = g
e.v = b
j.r = e
assert j.r.v.w.t.v.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.p: A = None
        self.x: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: C = None
        self.w: C = None
        self.s: F = None
        self.txt = txt

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

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

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

k.w = g
h.r = l
g.v = e
g.x = e
g.p = k
f.q = g
f.x = g
f.w = g
f.s = l
b.w = l
l.t = g
l.v = b
e.t = g
e.v = b
j.r = e
assert j.r.v.w.t.v.v.w.txt == "l"