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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: D = None
        self.q: B = None
        self.w: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: D = None
        self.y: A = None
        self.txt = txt

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

c.w = h
c.y = h
c.p = j
c.r = j
j.o = h
j.q = g
h.t = d
h.y = b
h.q = j
h.w = k
b.y = i
b.x = k
k.x = d
i.x = c
i.w = b
i.y = g
d.x = g
d.w = b
d.y = c
g.w = h
g.y = h
g.p = j
g.r = j
assert d.x.r.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: B = None
        self.r: B = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: D = None
        self.q: B = None
        self.w: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: D = None
        self.y: A = None
        self.txt = txt

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

c.w = h
c.y = h
c.p = j
c.r = j
j.o = h
j.q = g
h.t = d
h.y = b
h.q = j
h.w = k
b.y = i
b.x = k
k.x = d
i.x = c
i.w = b
i.y = g
d.x = g
d.w = b
d.y = c
g.w = h
g.y = h
g.p = j
g.r = j
assert d.x.r.q.y.txt == "h"