class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: C = None
        self.r: A = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: C = None
        self.r: A = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

h.z = k
b.y = d
b.w = d
b.r = h
b.s = h
d.r = c
k.w = d
k.x = j
k.v = b
i.v = d
i.r = d
i.p = k
i.z = c
c.t = i
c.p = j
j.w = d
j.x = k
j.v = b
assert b.y.r.p.txt == "j"