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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: C = None
        self.y: C = None
        self.o: A = None
        self.t: A = None
        self.q: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: E = None
        self.v: A = None
        self.r: D = None
        self.txt = txt

a = A("a")
f = B("f")
i = C("i")
b = D("b")
j = E("j")
c = F("c")
h = C("h")

a.w = b
a.p = f
f.p = j
i.y = c
i.q = c
b.q = c
j.s = a
j.o = a
j.t = a
j.z = i
j.y = i
j.q = b
c.o = a
c.v = a
c.y = j
c.r = b
h.y = c
h.q = c
assert b.q.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: C = None
        self.y: C = None
        self.o: A = None
        self.t: A = None
        self.q: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: E = None
        self.v: A = None
        self.r: D = None
        self.txt = txt

a = A("a")
f = B("f")
i = C("i")
b = D("b")
j = E("j")
c = F("c")
h = C("h")

a.w = b
a.p = f
f.p = j
i.y = c
i.q = c
b.q = c
j.s = a
j.o = a
j.t = a
j.z = i
j.y = i
j.q = b
c.o = a
c.v = a
c.y = j
c.r = b
h.y = c
h.q = c
assert b.q.y.s.txt == "a"