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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: D = None
        self.t: A = None
        self.r: D = None
        self.txt = txt

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

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

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

d.x = i
d.w = i
j.u = m
j.t = a
j.v = a
j.w = c
c.p = i
c.y = i
c.u = k
c.q = b
c.v = d
b.p = d
b.t = d
b.y = m
b.r = m
a.q = d
a.y = b
i.r = c
i.y = c
i.u = b
i.w = j
i.q = j
m.p = d
m.t = d
m.y = b
m.r = b
k.u = b
k.t = a
k.v = a
k.w = c
assert m.y.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: D = None
        self.t: A = None
        self.r: D = None
        self.txt = txt

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

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

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

d.x = i
d.w = i
j.u = m
j.t = a
j.v = a
j.w = c
c.p = i
c.y = i
c.u = k
c.q = b
c.v = d
b.p = d
b.t = d
b.y = m
b.r = m
a.q = d
a.y = b
i.r = c
i.y = c
i.u = b
i.w = j
i.q = j
m.p = d
m.t = d
m.y = b
m.r = b
k.u = b
k.t = a
k.v = a
k.w = c
assert m.y.r.p.txt == "d"