class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: B = None
        self.y: F = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

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

j.q = f
j.w = f
j.z = h
j.y = a
k.o = j
k.y = j
k.t = f
k.x = f
d.o = c
d.t = j
b.w = d
f.v = d
f.x = d
f.q = d
g.p = d
h.o = j
h.y = j
h.t = f
h.x = f
e.p = d
a.p = d
c.w = d
assert b.w.t.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: B = None
        self.y: F = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

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

j.q = f
j.w = f
j.z = h
j.y = a
k.o = j
k.y = j
k.t = f
k.x = f
d.o = c
d.t = j
b.w = d
f.v = d
f.x = d
f.q = d
g.p = d
h.o = j
h.y = j
h.t = f
h.x = f
e.p = d
a.p = d
c.w = d
assert b.w.t.w.v.txt == "d"