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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

d.p = l
d.v = l
d.x = l
d.s = c
d.q = b
d.r = g
g.w = h
g.u = d
g.q = d
g.p = i
b.y = l
c.r = j
j.y = h
a.u = j
l.u = j
h.w = g
h.u = d
h.q = d
h.p = c
i.r = j
assert g.w.w.w.p.r.y.w.p.r.txt == "j"