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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: C = None
        self.z: F = None
        self.y: B = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: C = None
        self.z: F = None
        self.y: B = None
        self.txt = txt

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

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

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