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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

d = A("d")
a = B("a")
g = C("g")
h = D("h")
e = E("e")
j = F("j")

d.w = j
a.v = h
a.w = g
g.r = e
g.t = e
g.w = h
h.v = j
h.y = j
h.q = a
e.v = h
j.p = e
j.t = a
assert d.w.t.v.y.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

d = A("d")
a = B("a")
g = C("g")
h = D("h")
e = E("e")
j = F("j")

d.w = j
a.v = h
a.w = g
g.r = e
g.t = e
g.w = h
h.v = j
h.y = j
h.q = a
e.v = h
j.p = e
j.t = a
assert d.w.t.v.y.t.v.txt == "h"