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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.u: B = None
        self.q: D = None
        self.o: F = None
        self.s: B = None
        self.t: C = None
        self.txt = txt

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

g = A("g")
d = B("d")
b = C("b")
h = D("h")
i = E("i")
j = F("j")

g.q = d
g.v = d
g.w = j
d.u = h
b.t = g
h.v = b
h.r = b
h.t = d
i.x = j
i.o = j
i.u = d
i.s = d
i.q = h
i.t = b
j.v = h
assert h.v.t.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: B = None
        self.w: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.u: B = None
        self.q: D = None
        self.o: F = None
        self.s: B = None
        self.t: C = None
        self.txt = txt

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

g = A("g")
d = B("d")
b = C("b")
h = D("h")
i = E("i")
j = F("j")

g.q = d
g.v = d
g.w = j
d.u = h
b.t = g
h.v = b
h.r = b
h.t = d
i.x = j
i.o = j
i.u = d
i.s = d
i.q = h
i.t = b
j.v = h
assert h.v.t.v.u.txt == "h"