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

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: B = None
        self.y: A = None
        self.r: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: C = None
        self.y: D = None
        self.txt = txt

h = A("h")
b = B("b")
a = C("a")
d = D("d")
m = E("m")
j = F("j")

h.w = d
h.u = b
b.v = d
b.y = a
a.u = j
a.t = b
a.y = h
a.r = d
d.p = j
d.s = b
m.w = a
m.x = j
m.s = j
j.u = d
j.y = d
j.z = a
assert j.y.s.v.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: B = None
        self.y: A = None
        self.r: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: C = None
        self.y: D = None
        self.txt = txt

h = A("h")
b = B("b")
a = C("a")
d = D("d")
m = E("m")
j = F("j")

h.w = d
h.u = b
b.v = d
b.y = a
a.u = j
a.t = b
a.y = h
a.r = d
d.p = j
d.s = b
m.w = a
m.x = j
m.s = j
j.u = d
j.y = d
j.z = a
assert j.y.s.v.s.y.txt == "a"