class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: A = None
        self.x: C = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

f = A("f")
m = B("m")
g = C("g")
e = D("e")
h = D("h")
n = A("n")
c = A("c")
j = A("j")
b = C("b")
i = A("i")

f.v = g
f.x = g
f.p = i
f.z = i
m.v = i
g.t = b
e.y = f
e.w = g
e.v = n
h.y = j
h.w = g
h.v = n
n.v = b
n.x = b
n.p = f
n.z = j
c.v = b
c.p = f
c.x = g
c.z = j
j.v = b
j.p = c
j.x = g
j.z = n
b.t = g
i.v = g
i.p = j
i.x = b
i.z = f
assert e.y.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: A = None
        self.x: C = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

f = A("f")
m = B("m")
g = C("g")
e = D("e")
h = D("h")
n = A("n")
c = A("c")
j = A("j")
b = C("b")
i = A("i")

f.v = g
f.x = g
f.p = i
f.z = i
m.v = i
g.t = b
e.y = f
e.w = g
e.v = n
h.y = j
h.w = g
h.v = n
n.v = b
n.x = b
n.p = f
n.z = j
c.v = b
c.p = f
c.x = g
c.z = j
j.v = b
j.p = c
j.x = g
j.z = n
b.t = g
i.v = g
i.p = j
i.x = b
i.z = f
assert e.y.v.t.txt == "b"